@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
@@ -105,11 +105,88 @@ export declare const PasteLikeCalls: ReadonlySet<string>;
105
105
  * when the name is not one of them, an argument does not resolve, or the call does not match what the entry
106
106
  * declares. Shared by the value solver ({@link resolveAsStringFn}) and construction-time name resolution.
107
107
  */
108
- export declare function foldStringCall<Info>(node: RNamedFunctionCall<Info>, resolveArg: (arg: RNode<Info>) => string | undefined): string | number | undefined;
108
+ declare function foldStringCall<Info>(this: void, node: RNamedFunctionCall<Info>, resolveArg: (arg: RNode<Info>) => string | undefined): string | number | undefined;
109
109
  /**
110
110
  * Resolves any call of a {@link StringFns} entry to a {@link Value}, with its arguments in any order R accepts:
111
111
  * a join like `paste0("cfg_", k)` when every part resolves to a single string constant, and a transformation
112
112
  * like `basename(p)` when its argument does. Anything that does not resolve stays `Top`.
113
113
  */
114
- export declare function resolveAsStringFn(args: BuiltInEvalHandlerArgs): Value;
114
+ declare function resolveAsStringFn(this: void, args: BuiltInEvalHandlerArgs): Value;
115
+ /**
116
+ * Folding the string built-ins, from `paste` to `basename`.
117
+ */
118
+ export declare const StringFold: {
119
+ readonly name: "StringFold";
120
+ /** every string built-in that is folded, see {@link StringFns} */
121
+ readonly fns: {
122
+ readonly paste: {
123
+ readonly pkg: PkgName.Base;
124
+ readonly params: readonly ["...", "sep"];
125
+ readonly defaults: {
126
+ readonly sep: " ";
127
+ };
128
+ readonly ignored: readonly ["collapse"];
129
+ readonly fold: (parts: string[], sep: string) => string;
130
+ };
131
+ readonly paste0: {
132
+ readonly pkg: PkgName.Base;
133
+ readonly params: readonly ["...", "sep"];
134
+ readonly defaults: {
135
+ readonly sep: "";
136
+ };
137
+ readonly ignored: readonly ["collapse"];
138
+ readonly fold: (parts: string[], sep: string) => string;
139
+ };
140
+ readonly 'file.path': {
141
+ readonly pkg: PkgName.Base;
142
+ readonly params: readonly ["...", "fsep"];
143
+ readonly defaults: {
144
+ readonly fsep: "/";
145
+ };
146
+ readonly fold: (parts: string[], fsep: string) => string;
147
+ };
148
+ readonly here: {
149
+ readonly pkg: PkgName.Here;
150
+ readonly params: readonly ["..."];
151
+ readonly fold: (parts: string[]) => string;
152
+ };
153
+ readonly basename: {
154
+ readonly pkg: PkgName.Base;
155
+ readonly params: readonly ["path"];
156
+ readonly fold: typeof basename;
157
+ };
158
+ readonly dirname: {
159
+ readonly pkg: PkgName.Base;
160
+ readonly params: readonly ["path"];
161
+ readonly fold: typeof dirname;
162
+ };
163
+ readonly toupper: {
164
+ readonly pkg: PkgName.Base;
165
+ readonly params: readonly ["x"];
166
+ readonly fold: (s: string) => string;
167
+ };
168
+ readonly tolower: {
169
+ readonly pkg: PkgName.Base;
170
+ readonly params: readonly ["x"];
171
+ readonly fold: (s: string) => string;
172
+ };
173
+ readonly trimws: {
174
+ readonly pkg: PkgName.Base;
175
+ readonly params: readonly ["x"];
176
+ readonly fold: (s: string) => string;
177
+ };
178
+ /** R counts characters, so we count code points rather than UTF-16 units */
179
+ readonly nchar: {
180
+ readonly pkg: PkgName.Base;
181
+ readonly params: readonly ["x"];
182
+ readonly fold: (s: string) => number;
183
+ };
184
+ };
185
+ /** the calls pasting their arguments together, see {@link PasteLikeCalls} */
186
+ readonly pasteLike: ReadonlySet<string>;
187
+ /** What a string call amounts to; see {@link resolveAsStringFn}. */
188
+ readonly call: typeof resolveAsStringFn;
189
+ /** The string a call in the AST folds to; see {@link foldStringCall}. */
190
+ readonly fold: typeof foldStringCall;
191
+ };
115
192
  export {};
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PasteLikeCalls = exports.StringFns = void 0;
4
- exports.foldStringCall = foldStringCall;
5
- exports.resolveAsStringFn = resolveAsStringFn;
3
+ exports.StringFold = exports.PasteLikeCalls = exports.StringFns = void 0;
6
4
  const identifier_1 = require("../../environments/identifier");
7
5
  const r_value_1 = require("../values/r-value");
8
6
  const string_constants_1 = require("../values/string/string-constants");
@@ -74,9 +72,6 @@ function foldStringCall(node, resolveArg) {
74
72
  if (matched === undefined) {
75
73
  return undefined;
76
74
  }
77
- /* a fold that reads the characters cannot run on source text with an escape still in it (`\t` is two chars
78
- * there); joining does not read them, so the entries collecting a `...` are exempt */
79
- const literal = !known.params.includes('...');
80
75
  const args = [];
81
76
  for (const [at, slot] of matched.entries()) {
82
77
  if (Array.isArray(slot)) {
@@ -97,7 +92,7 @@ function foldStringCall(node, resolveArg) {
97
92
  }
98
93
  // the argument *was* given, so failing to resolve it means we do not know the result, defaults do not apply
99
94
  const value = resolveArg(slot);
100
- if (value === undefined || (literal && value.includes('\\'))) {
95
+ if (value === undefined) {
101
96
  return undefined;
102
97
  }
103
98
  args.push(value);
@@ -120,4 +115,18 @@ function resolveAsStringFn(args) {
120
115
  }
121
116
  return typeof folded === 'number' ? (0, interval_constants_1.intervalFrom)(folded, folded) : (0, string_constants_1.stringFrom)(folded);
122
117
  }
118
+ /**
119
+ * Folding the string built-ins, from `paste` to `basename`.
120
+ */
121
+ exports.StringFold = {
122
+ name: 'StringFold',
123
+ /** every string built-in that is folded, see {@link StringFns} */
124
+ fns: exports.StringFns,
125
+ /** the calls pasting their arguments together, see {@link PasteLikeCalls} */
126
+ pasteLike: exports.PasteLikeCalls,
127
+ /** What a string call amounts to; see {@link resolveAsStringFn}. */
128
+ call: resolveAsStringFn,
129
+ /** The string a call in the AST folds to; see {@link foldStringCall}. */
130
+ fold: foldStringCall
131
+ };
123
132
  //# sourceMappingURL=resolve-strings.js.map
@@ -1,29 +1,12 @@
1
1
  import type { BuiltInEvalHandlerArgs } from '../../environments/built-in';
2
2
  import { type Lift, Top, type Value, type ValueNumber, type ValueVector } from '../values/r-value';
3
3
  /**
4
- * Helper function used by {@link Resolve.toValue}, please use that instead, if
5
- * you want to resolve the value of an identifier / node
6
- *
7
- * This function converts an RNode to its Value, either directly for a constant or by handing the node
8
- * to the {@link BuiltInEvalHandler} its built-in declares, which may resolve further nodes recursively.
9
- * @returns resolved value or top/bottom
4
+ * Converts an RNode to its Value, either directly for a constant or by handing the node to the
5
+ * {@link BuiltInEvalHandler} its built-in declares, which may resolve further nodes recursively.
6
+ * Helper of {@link Resolve.toValue}; use that instead to resolve the value of an identifier or node.
10
7
  */
11
8
  export declare function resolveNode(args: BuiltInEvalHandlerArgs): Value;
12
- /**
13
- * Helper function used by {@link Resolve.toValue}, please use that instead, if
14
- * you want to resolve the value of an identifier / node
15
- *
16
- * This function resolves a vector function call `c` to a {@link ValueVector}
17
- * by recursively resolving the values of the arguments by calling {@link Resolve.toValue}
18
- * @returns ValueVector or Top
19
- */
9
+ /** Resolves a vector call `c` to a {@link ValueVector}; helper of {@link resolveNode|resolveNode}. */
20
10
  export declare function resolveAsVector(args: BuiltInEvalHandlerArgs): ValueVector | typeof Top;
21
- /**
22
- * Helper function used by {@link Resolve.toValue}, please use that instead, if
23
- * you want to resolve the value of an identifier / node
24
- *
25
- * This function resolves a binary sequence operator `:` to a {@link ValueVector} of {@link ValueNumber}s
26
- * by recursively resolving the values of the arguments by calling {@link Resolve.toValue}
27
- * @returns ValueVector of ValueNumbers or Top
28
- */
11
+ /** Resolves the sequence operator `:` to a {@link ValueVector} of {@link ValueNumber}s; helper of {@link resolveNode}. */
29
12
  export declare function resolveAsSeq(args: BuiltInEvalHandlerArgs): ValueVector<Lift<ValueNumber[]>> | typeof Top;
@@ -6,11 +6,11 @@ exports.resolveAsSeq = resolveAsSeq;
6
6
  const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
7
7
  const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
8
8
  const r_value_1 = require("../../../util/r-value");
9
- const interval_constants_1 = require("../values/intervals/interval-constants");
10
9
  const logical_constants_1 = require("../values/logical/logical-constants");
11
10
  const r_value_2 = require("../values/r-value");
12
11
  const string_constants_1 = require("../values/string/string-constants");
13
12
  const vector_constants_1 = require("../values/vectors/vector-constants");
13
+ const general_1 = require("../values/general");
14
14
  const scalar_constants_1 = require("../values/scalar/scalar-constants");
15
15
  const identifier_1 = require("../../environments/identifier");
16
16
  const df_helper_1 = require("../../graph/df-helper");
@@ -25,7 +25,9 @@ const r_binary_op_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-bina
25
25
  function evalHandlerOf(name, environment, ctx) {
26
26
  const defs = environment ?
27
27
  resolve_helper_1.Resolve.byNameAndType(name, environment, identifier_1.ReferenceType.BuiltInFunction)
28
- : ctx.env.builtInEnvironment.memory.get(identifier_1.Identifier.getName(name));
28
+ /* without an environment the search path is unknown, so what a package states about the name has its say */
29
+ : ctx.env.builtInEnvironment.memory.get(identifier_1.Identifier.getName(name))
30
+ ?? ctx.env.statedDefinitionsOf(name);
29
31
  const def = defs?.length === 1 ? defs[0] : undefined;
30
32
  return def?.type === identifier_1.ReferenceType.BuiltInFunction ? def.evalHandler : undefined;
31
33
  }
@@ -55,26 +57,24 @@ function evalNameOf({ node, graph }) {
55
57
  if (name !== undefined && identifier_1.Identifier.getName(name) !== identifier_1.Identifier.getName(named)) {
56
58
  return undefined;
57
59
  }
58
- name = named;
60
+ /* the same call is named bare by one origin and qualified by another; the qualified one says whose it is */
61
+ name = name !== undefined && identifier_1.Identifier.getNamespace(named) === undefined ? name : named;
59
62
  }
60
63
  return name;
61
64
  }
62
65
  /**
63
- * Helper function used by {@link Resolve.toValue}, please use that instead, if
64
- * you want to resolve the value of an identifier / node
65
- *
66
- * This function converts an RNode to its Value, either directly for a constant or by handing the node
67
- * to the {@link BuiltInEvalHandler} its built-in declares, which may resolve further nodes recursively.
68
- * @returns resolved value or top/bottom
66
+ * Converts an RNode to its Value, either directly for a constant or by handing the node to the
67
+ * {@link BuiltInEvalHandler} its built-in declares, which may resolve further nodes recursively.
68
+ * Helper of {@link Resolve.toValue}; use that instead to resolve the value of an identifier or node.
69
69
  */
70
70
  function resolveNode(args) {
71
71
  const { node, environment, ctx } = args;
72
72
  const nt = node.type;
73
73
  if (nt === type_1.RType.String) {
74
- return (0, string_constants_1.stringFrom)(node.content.str);
74
+ return string_constants_1.RStringLiteral.value(node.content) ?? r_value_2.Top;
75
75
  }
76
76
  else if (nt === type_1.RType.Number) {
77
- return (0, interval_constants_1.intervalFrom)(node.content.num, node.content.num);
77
+ return (0, general_1.valueFromRNumber)(node.content);
78
78
  }
79
79
  else if (nt === type_1.RType.Logical) {
80
80
  return node.content.valueOf() ? logical_constants_1.ValueLogicalTrue : logical_constants_1.ValueLogicalFalse;
@@ -86,14 +86,7 @@ function resolveNode(args) {
86
86
  const handler = name === undefined ? undefined : evalHandlerOf(name, environment, ctx);
87
87
  return handler?.(args) ?? r_value_2.Top;
88
88
  }
89
- /**
90
- * Helper function used by {@link Resolve.toValue}, please use that instead, if
91
- * you want to resolve the value of an identifier / node
92
- *
93
- * This function resolves a vector function call `c` to a {@link ValueVector}
94
- * by recursively resolving the values of the arguments by calling {@link Resolve.toValue}
95
- * @returns ValueVector or Top
96
- */
89
+ /** Resolves a vector call `c` to a {@link ValueVector}; helper of {@link resolveNode|resolveNode}. */
97
90
  function resolveAsVector(args) {
98
91
  const node = args.node;
99
92
  if (!r_function_call_1.RFunctionCall.is(node)) {
@@ -101,14 +94,7 @@ function resolveAsVector(args) {
101
94
  }
102
95
  return (0, vector_constants_1.vectorFrom)((0, vector_constants_1.flattenVectorElements)(node.arguments.map(arg => arg !== r_function_call_1.EmptyArgument ? resolve_helper_1.Resolve.toValue(arg.value, args) : r_value_2.Top)));
103
96
  }
104
- /**
105
- * Helper function used by {@link Resolve.toValue}, please use that instead, if
106
- * you want to resolve the value of an identifier / node
107
- *
108
- * This function resolves a binary sequence operator `:` to a {@link ValueVector} of {@link ValueNumber}s
109
- * by recursively resolving the values of the arguments by calling {@link Resolve.toValue}
110
- * @returns ValueVector of ValueNumbers or Top
111
- */
97
+ /** Resolves the sequence operator `:` to a {@link ValueVector} of {@link ValueNumber}s; helper of {@link resolveNode}. */
112
98
  function resolveAsSeq(args) {
113
99
  const operator = args.node;
114
100
  if (!r_binary_op_1.RBinaryOp.is(operator)) {
@@ -117,20 +103,24 @@ function resolveAsSeq(args) {
117
103
  const leftValue = (0, r_value_1.unliftRValue)(resolve_helper_1.Resolve.toValue(operator.lhs, args));
118
104
  const rightValue = (0, r_value_1.unliftRValue)(resolve_helper_1.Resolve.toValue(operator.rhs, args));
119
105
  if ((0, r_value_1.isRNumberValue)(leftValue) && (0, r_value_1.isRNumberValue)(rightValue)) {
120
- return (0, vector_constants_1.vectorFrom)(createNumberSequence(leftValue, rightValue).map(scalar_constants_1.liftScalar));
106
+ const sequence = createNumberSequence(leftValue, rightValue);
107
+ return sequence === undefined ? r_value_2.Top : (0, vector_constants_1.vectorFrom)(sequence.map(scalar_constants_1.liftScalar));
121
108
  }
122
109
  return r_value_2.Top;
123
110
  }
111
+ /**
112
+ * The elements `from:to` runs over, counting down whenever `to` is the smaller one, and stopping before it
113
+ * would pass `to` (`1:3.5` ends at `3`). `undefined` for a bound that names no position to count from or to.
114
+ */
124
115
  function createNumberSequence(start, end) {
116
+ if (!Number.isFinite(start.num) || !Number.isFinite(end.num)) {
117
+ return undefined;
118
+ }
119
+ const step = start.num <= end.num ? 1 : -1;
125
120
  const sequence = [];
126
- const min = Math.min(start.num, end.num);
127
- const max = Math.max(start.num, end.num);
128
- for (let i = min; i <= max; i++) {
121
+ for (let i = start.num; step > 0 ? i <= end.num : i >= end.num; i += step) {
129
122
  sequence.push({ ...start, num: i });
130
123
  }
131
- if (start > end) {
132
- sequence.reverse();
133
- }
134
124
  return sequence;
135
125
  }
136
126
  //# sourceMappingURL=resolve.js.map
@@ -1,5 +1,6 @@
1
1
  import type { RNodeWithParent } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
2
- import { type Lift, type Value, type ValueSet, Bottom, Top } from './r-value';
2
+ import { type Lift, type Value, type ValueInterval, type ValueSet, Bottom, Top } from './r-value';
3
+ import type { RNumberValue } from '../../../r-bridge/lang-4.x/convert-values';
3
4
  /**
4
5
  * Takes n potentially lifted ops and returns `Top` or `Bottom` if any is `Top` or `Bottom`.
5
6
  */
@@ -24,6 +25,11 @@ export declare function soleValue<T extends Value['type']>(this: void, set: Valu
24
25
  * @returns abstract value
25
26
  */
26
27
  export declare function valueFromTsValue(a: unknown): Value;
28
+ /**
29
+ * The interval a number literal stands for. A complex literal keeps its flag, so that nothing folds `2i` as
30
+ * the real number its lexeme starts with.
31
+ */
32
+ export declare function valueFromRNumber(value: RNumberValue): ValueInterval;
27
33
  /**
28
34
  * Converts a constant from an RNode into an abstract value
29
35
  * @param a - RNode constant
@@ -4,6 +4,7 @@ exports.bottomTopGuard = bottomTopGuard;
4
4
  exports.valueSetGuard = valueSetGuard;
5
5
  exports.soleValue = soleValue;
6
6
  exports.valueFromTsValue = valueFromTsValue;
7
+ exports.valueFromRNumber = valueFromRNumber;
7
8
  exports.valueFromRNodeConstant = valueFromRNodeConstant;
8
9
  const interval_constants_1 = require("./intervals/interval-constants");
9
10
  const logical_constants_1 = require("./logical/logical-constants");
@@ -14,6 +15,7 @@ const r_function_definition_1 = require("../../../r-bridge/lang-4.x/ast/model/no
14
15
  const r_logical_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-logical");
15
16
  const r_number_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-number");
16
17
  const r_string_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
18
+ const scalar_constants_1 = require("./scalar/scalar-constants");
17
19
  /**
18
20
  * Takes n potentially lifted ops and returns `Top` or `Bottom` if any is `Top` or `Bottom`.
19
21
  */
@@ -50,7 +52,11 @@ function soleValue(set, type) {
50
52
  * @returns abstract value
51
53
  */
52
54
  function valueFromTsValue(a) {
53
- if (a === undefined) {
55
+ if (a === r_value_1.Top || a === r_value_1.Bottom) {
56
+ /* what a definition states outright, as `NA` does: R has a value there, flowR has no way to hold it */
57
+ return a;
58
+ }
59
+ else if (a === undefined) {
54
60
  return r_value_1.Bottom;
55
61
  }
56
62
  else if (a === null) {
@@ -70,6 +76,14 @@ function valueFromTsValue(a) {
70
76
  }
71
77
  return r_value_1.Top;
72
78
  }
79
+ /**
80
+ * The interval a number literal stands for. A complex literal keeps its flag, so that nothing folds `2i` as
81
+ * the real number its lexeme starts with.
82
+ */
83
+ function valueFromRNumber(value) {
84
+ const scalar = (0, scalar_constants_1.getScalarFromInteger)(value.num, !value.complexNumber && Number.isInteger(value.num), value.complexNumber);
85
+ return (0, interval_constants_1.intervalFromValues)(scalar, scalar);
86
+ }
73
87
  /**
74
88
  * Converts a constant from an RNode into an abstract value
75
89
  * @param a - RNode constant
@@ -77,10 +91,10 @@ function valueFromTsValue(a) {
77
91
  */
78
92
  function valueFromRNodeConstant(a) {
79
93
  if (r_string_1.RString.is(a)) {
80
- return (0, string_constants_1.stringFrom)(a.content.str);
94
+ return string_constants_1.RStringLiteral.value(a.content) ?? r_value_1.Top;
81
95
  }
82
96
  else if (r_number_1.RNumber.is(a)) {
83
- return (0, interval_constants_1.intervalFrom)(a.content.num, a.content.num);
97
+ return valueFromRNumber(a.content);
84
98
  }
85
99
  else if (r_logical_1.RLogical.is(a)) {
86
100
  return a.content.valueOf() ? logical_constants_1.ValueLogicalTrue : logical_constants_1.ValueLogicalFalse;
@@ -1,23 +1,24 @@
1
1
  import type { RStringValue } from '../../../../r-bridge/lang-4.x/convert-values';
2
2
  import { type Lift, type Value, type ValueString } from '../r-value';
3
- /**
4
- * Lift a raw string or R string value into a ValueString.
5
- * @see {@link liftString} - for lifting a Lift<RStringValue>
6
- */
3
+ /** lift a raw string or R string value into a ValueString; see {@link liftString} for lifting a Lift<RStringValue> */
7
4
  export declare function stringFrom(str: RStringValue | string): ValueString;
8
- /**
9
- * Lift a Lift<RStringValue> into a ValueString.
10
- * @see {@link stringFrom} - for lifting a raw string or R string value.
11
- */
5
+ /** the characters an R string literal stands for (`"a\tb"` is three characters, not the four its source is written with); undefined for an escape R would reject */
6
+ declare function unescapeRString(this: void, str: string): string | undefined;
7
+ /** the {@link ValueString} an R string literal stands for, escapes resolved (a raw string has none, so it stands for its characters as written); undefined for an escape R would reject */
8
+ declare function stringFromLiteral(this: void, value: RStringValue): ValueString | undefined;
9
+ /** lift a Lift<RStringValue> into a ValueString; see {@link stringFrom} for lifting a raw string or R string value */
12
10
  export declare function liftString(str: Lift<RStringValue>): ValueString;
13
- /**
14
- * Collect strings from an array of ValueString.
15
- * If any value is not a string, or is Bottom/Top, undefined is returned.
16
- * @param a - The array of Value to collect strings from.
17
- * @param withQuotes - Whether to include the quotes in the returned strings.
18
- * @returns - An array of strings, or undefined if any value is not a string.
19
- */
11
+ /** collect strings from an array of ValueString, with quotes if `withQuotes`; undefined if any value is not a string, or is Bottom/Top */
20
12
  export declare function collectStrings(a: Value[], withQuotes?: boolean): string[] | undefined;
13
+ /** utility functions for the strings a program writes down, as opposed to the ones it computes */
14
+ export declare const RStringLiteral: {
15
+ readonly name: "RStringLiteral";
16
+ /** What the escapes in a literal stand for; see {@link unescapeRString}. */
17
+ readonly unescape: typeof unescapeRString;
18
+ /** The value a literal stands for, `undefined` when R would not accept it; see {@link stringFromLiteral}. */
19
+ readonly value: typeof stringFromLiteral;
20
+ };
21
21
  export declare const ValueEmptyString: ValueString<Lift<RStringValue>>;
22
22
  export declare const ValueStringTop: ValueString<Lift<RStringValue>>;
23
23
  export declare const ValueStringBot: ValueString<Lift<RStringValue>>;
24
+ export {};
@@ -1,41 +1,65 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ValueStringBot = exports.ValueStringTop = exports.ValueEmptyString = void 0;
3
+ exports.ValueStringBot = exports.ValueStringTop = exports.ValueEmptyString = exports.RStringLiteral = void 0;
4
4
  exports.stringFrom = stringFrom;
5
5
  exports.liftString = liftString;
6
6
  exports.collectStrings = collectStrings;
7
7
  const general_1 = require("../general");
8
8
  const r_value_1 = require("../r-value");
9
- /**
10
- * Lift a raw string or R string value into a ValueString.
11
- * @see {@link liftString} - for lifting a Lift<RStringValue>
12
- */
9
+ /** lift a raw string or R string value into a ValueString; see {@link liftString} for lifting a Lift<RStringValue> */
13
10
  function stringFrom(str) {
14
- return {
15
- type: 'string',
16
- value: typeof str === 'string' ? {
17
- quotes: '"',
18
- str: str
19
- } : str,
20
- };
11
+ return { type: 'string', value: typeof str === 'string' ? { quotes: '"', str } : str };
21
12
  }
22
- /**
23
- * Lift a Lift<RStringValue> into a ValueString.
24
- * @see {@link stringFrom} - for lifting a raw string or R string value.
25
- */
13
+ /** the escapes standing for exactly one character, everything else R writes as a numeric code */
14
+ const SimpleEscapes = {
15
+ n: '\n',
16
+ r: '\r',
17
+ t: '\t',
18
+ b: '\b',
19
+ a: '\x07',
20
+ f: '\f',
21
+ v: '\v',
22
+ '\\': '\\',
23
+ '"': '"',
24
+ '\'': '\'',
25
+ '`': '`'
26
+ };
27
+ /** the largest code point there is, so an `\U` escape naming none of them is rejected instead of throwing */
28
+ const MaxCodePoint = 0x10FFFF;
29
+ /** `\xnn`, `\u{nnnn}`, `\unnnn`, `\U{nnnnnnnn}`, `\Unnnnnnnn`, an octal `\nnn`, or a single-character escape */
30
+ const EscapePattern = /\\(?:x([0-9a-fA-F]{1,2})|u\{([0-9a-fA-F]{1,6})\}|u([0-9a-fA-F]{1,4})|U\{([0-9a-fA-F]{1,8})\}|U([0-9a-fA-F]{1,8})|([0-7]{1,3})|([\s\S]))/g;
31
+ /** the characters an R string literal stands for (`"a\tb"` is three characters, not the four its source is written with); undefined for an escape R would reject */
32
+ function unescapeRString(str) {
33
+ if (!str.includes('\\')) {
34
+ return str;
35
+ }
36
+ let rejected = false;
37
+ const out = str.replace(EscapePattern, (_all, hex, uBraced, u, bigBraced, big, octal, single) => {
38
+ const code = hex ?? uBraced ?? u ?? bigBraced ?? big;
39
+ if (code !== undefined || octal !== undefined) {
40
+ const point = code !== undefined ? parseInt(code, 16) : parseInt(octal, 8);
41
+ rejected ||= point > MaxCodePoint;
42
+ return point > MaxCodePoint ? '' : String.fromCodePoint(point);
43
+ }
44
+ const simple = single === undefined ? undefined : SimpleEscapes[single];
45
+ rejected ||= simple === undefined;
46
+ return simple ?? '';
47
+ });
48
+ return rejected ? undefined : out;
49
+ }
50
+ /** the {@link ValueString} an R string literal stands for, escapes resolved (a raw string has none, so it stands for its characters as written); undefined for an escape R would reject */
51
+ function stringFromLiteral(value) {
52
+ if (value.flag === 'raw') {
53
+ return stringFrom(value);
54
+ }
55
+ const str = unescapeRString(value.str);
56
+ return str === undefined ? undefined : stringFrom({ ...value, str });
57
+ }
58
+ /** lift a Lift<RStringValue> into a ValueString; see {@link stringFrom} for lifting a raw string or R string value */
26
59
  function liftString(str) {
27
- return {
28
- type: 'string',
29
- value: str
30
- };
60
+ return { type: 'string', value: str };
31
61
  }
32
- /**
33
- * Collect strings from an array of ValueString.
34
- * If any value is not a string, or is Bottom/Top, undefined is returned.
35
- * @param a - The array of Value to collect strings from.
36
- * @param withQuotes - Whether to include the quotes in the returned strings.
37
- * @returns - An array of strings, or undefined if any value is not a string.
38
- */
62
+ /** collect strings from an array of ValueString, with quotes if `withQuotes`; undefined if any value is not a string, or is Bottom/Top */
39
63
  function collectStrings(a, withQuotes = false) {
40
64
  if ((0, general_1.bottomTopGuard)(a)) {
41
65
  return undefined;
@@ -54,6 +78,14 @@ function collectStrings(a, withQuotes = false) {
54
78
  }
55
79
  return values;
56
80
  }
81
+ /** utility functions for the strings a program writes down, as opposed to the ones it computes */
82
+ exports.RStringLiteral = {
83
+ name: 'RStringLiteral',
84
+ /** What the escapes in a literal stand for; see {@link unescapeRString}. */
85
+ unescape: unescapeRString,
86
+ /** The value a literal stands for, `undefined` when R would not accept it; see {@link stringFromLiteral}. */
87
+ value: stringFromLiteral
88
+ };
57
89
  exports.ValueEmptyString = stringFrom('');
58
90
  exports.ValueStringTop = liftString(r_value_1.Top);
59
91
  exports.ValueStringBot = liftString(r_value_1.Bottom);
@@ -3,6 +3,7 @@ import { type DataflowProcessors } from './processor';
3
3
  import type { NormalizedAst, ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
4
4
  import type { KnownParserType, Parser } from '../r-bridge/parser';
5
5
  import type { FlowrAnalyzerContext } from '../project/context/flowr-analyzer-context';
6
+ import { type DataflowBudgetTracker } from '../gas';
6
7
  /**
7
8
  * The best friend of {@link produceDataFlowGraph} and {@link processDataflowFor}.
8
9
  * Maps every {@link RType} in the normalized AST to a processor.
@@ -14,4 +15,4 @@ export declare const processors: DataflowProcessors<ParentInformation>;
14
15
  * (e.g., in the event of a `source` call).
15
16
  * For the actual, canonical fold entry point, see {@link processDataflowFor}.
16
17
  */
17
- export declare function produceDataFlowGraph<OtherInfo>(parser: Parser<KnownParserType>, completeAst: NormalizedAst<OtherInfo & ParentInformation>, ctx: FlowrAnalyzerContext): DataflowInformation;
18
+ export declare function produceDataFlowGraph<OtherInfo>(parser: Parser<KnownParserType>, completeAst: NormalizedAst<OtherInfo & ParentInformation>, ctx: FlowrAnalyzerContext, budget?: DataflowBudgetTracker | undefined): DataflowInformation;
@@ -23,13 +23,12 @@ const built_in_function_definition_1 = require("./internal/process/functions/cal
23
23
  const transitive_side_effects_1 = require("./internal/process/functions/call/built-in/transitive-side-effects");
24
24
  const flowr_file_1 = require("../project/context/flowr-file");
25
25
  const vertex_1 = require("./graph/vertex");
26
- /** Round cap for the transitive-side-effect fixpoint. */
27
- const transitiveSideEffectRounds = 32;
28
26
  const identifier_1 = require("./environments/identifier");
29
27
  const quoted_1 = require("./internal/process/functions/call/quoted");
30
28
  const range_1 = require("../util/range");
31
29
  const logger_1 = require("./logger");
32
30
  const gas_1 = require("../gas");
31
+ const config_1 = require("../config");
33
32
  const df_helper_1 = require("./graph/df-helper");
34
33
  const arrays_1 = require("../util/collections/arrays");
35
34
  /**
@@ -125,7 +124,19 @@ function resolveLinkToSideEffects(graph, ctx) {
125
124
  * (e.g., in the event of a `source` call).
126
125
  * For the actual, canonical fold entry point, see {@link processDataflowFor}.
127
126
  */
128
- function produceDataFlowGraph(parser, completeAst, ctx) {
127
+ function produceDataFlowGraph(parser, completeAst, ctx, budget = ctx.gas.budget(gas_1.GasFeatureKey.Dataflow)) {
128
+ return (0, gas_1.withDataflowBudget)(budget, () => {
129
+ const df = extractDataFlowGraph(parser, completeAst, ctx);
130
+ const cut = budget?.exhausted;
131
+ if (cut !== undefined) {
132
+ logger_1.dataflowLogger.warn(`Dataflow analysis was cut short after ${cut.reached} ${cut.dimension} (budget ${cut.limit}); the graph is partial.`);
133
+ df.cutShort = cut;
134
+ }
135
+ return df;
136
+ });
137
+ }
138
+ /** The extraction itself, always run inside the {@link withDataflowBudget} scope {@link produceDataFlowGraph} opens. */
139
+ function extractDataFlowGraph(parser, completeAst, ctx) {
129
140
  // we freeze the files here to avoid endless modifications during processing
130
141
  const files = completeAst.ast.files.slice();
131
142
  ctx.files.addConsideredFile(files[0].filePath ? files[0].filePath : flowr_file_1.FlowrFile.INLINE_PATH);
@@ -158,7 +169,8 @@ function produceDataFlowGraph(parser, completeAst, ctx) {
158
169
  // resolve linkages and propagate transitive side effects across calls to a fixpoint
159
170
  (0, built_in_function_definition_1.updateNestedFunctionCalls)(df.graph, df.environment, ctx);
160
171
  const escapedNames = new Set();
161
- for (let round = 0; round < transitiveSideEffectRounds; round++) {
172
+ const rounds = ctx.config.solver.transitiveSideEffectRounds ?? config_1.DefaultTransitiveSideEffectRounds;
173
+ for (let round = 0; round < rounds; round++) {
162
174
  const { environment, grew, escapedNames: roundNames } = df_helper_1.Dataflow.sideEffects.propagateTransitive(df.graph, df.environment, ctx);
163
175
  df.environment = environment;
164
176
  for (const n of roundNames) {
@@ -0,0 +1,35 @@
1
+ import type { DataflowGraph } from '../graph/graph';
2
+ import type { ArgProps } from '../environments/built-in-props';
3
+ import { type BuiltInLookup } from './frame-reflection';
4
+ import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
5
+ import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
6
+ /** What a function does with its formals, as an {@link ArgProp} bitfield keyed by the id of each formal's name. */
7
+ export type FunctionArgumentRoles = Record<NodeId, ArgProps>;
8
+ /** What to ask for beyond the definitions themselves, see {@link ArgumentRoles.of}. */
9
+ export interface ArgumentRolesOptions {
10
+ /** how to ask what a built-in states, so a configured or overwritten one answers */
11
+ readonly ctx?: ReadOnlyFlowrAnalyzerContext;
12
+ /** how far a value is followed back through names and calls (default {@link DefaultDepth}) */
13
+ readonly maxDepth?: number;
14
+ }
15
+ /**
16
+ * What each definition in `ids` does with its formals, as {@link ArgProps}. A formal is {@link ArgProp.Alias}
17
+ * only when the result is *always* that formal; every other bit is what the calls in the body state for it.
18
+ * @useInstead {@link ArgumentRoles.of}
19
+ */
20
+ declare function argumentRolesOfFunctions(this: void, ids: Iterable<NodeId>, graph: DataflowGraph, options?: ArgumentRolesOptions): Record<NodeId, FunctionArgumentRoles>;
21
+ /** What the functions of a program do with the arguments they are handed. */
22
+ export declare const ArgumentRoles: {
23
+ readonly name: "ArgumentRoles";
24
+ /** The roles of several definitions, sharing the built-in lookups; see {@link argumentRolesOfFunctions}. */
25
+ readonly of: typeof argumentRolesOfFunctions;
26
+ /** how far a value is followed back when nothing else is asked for */
27
+ readonly maxDepth: 6;
28
+ };
29
+ /** What one run carries along, so the built-in lookups are shared between the definitions it answers. */
30
+ export interface LookupState {
31
+ readonly graph: DataflowGraph;
32
+ /** what flowR states about a built-in, answered once per name */
33
+ readonly info: BuiltInLookup;
34
+ }
35
+ export {};