@eagleoutice/flowr 2.14.4 → 2.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (384) hide show
  1. package/README.md +77 -64
  2. package/abstract-interpretation/absint-inference.d.ts +347 -0
  3. package/abstract-interpretation/{absint-visitor.js → absint-inference.js} +327 -97
  4. package/abstract-interpretation/abstract-semantics.d.ts +246 -0
  5. package/abstract-interpretation/abstract-semantics.js +3 -0
  6. package/abstract-interpretation/data-frame/{mappers/arguments.d.ts → arguments.d.ts} +18 -16
  7. package/abstract-interpretation/data-frame/{mappers/arguments.js → arguments.js} +20 -21
  8. package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +52 -0
  9. package/abstract-interpretation/data-frame/dataframe-semantics.js +1665 -0
  10. package/abstract-interpretation/data-frame/resolve-args.js +4 -4
  11. package/abstract-interpretation/data-frame/semantics.d.ts +15 -21
  12. package/abstract-interpretation/data-frame/semantics.js +27 -29
  13. package/abstract-interpretation/data-frame/shape-inference.d.ts +28 -24
  14. package/abstract-interpretation/data-frame/shape-inference.js +14 -79
  15. package/abstract-interpretation/domains/interval-domain.d.ts +5 -1
  16. package/abstract-interpretation/domains/interval-domain.js +25 -33
  17. package/abstract-interpretation/domains/multi-value-state-domain.d.ts +6 -3
  18. package/abstract-interpretation/domains/multi-value-state-domain.js +24 -4
  19. package/abstract-interpretation/domains/partial-product-domain.d.ts +12 -6
  20. package/abstract-interpretation/domains/partial-product-domain.js +26 -43
  21. package/abstract-interpretation/domains/positive-interval-domain.d.ts +1 -6
  22. package/abstract-interpretation/domains/positive-interval-domain.js +3 -29
  23. package/abstract-interpretation/domains/product-domain.d.ts +1 -1
  24. package/abstract-interpretation/domains/set-range-domain.d.ts +6 -0
  25. package/abstract-interpretation/domains/set-range-domain.js +29 -62
  26. package/abstract-interpretation/domains/state-abstract-domain.d.ts +9 -2
  27. package/abstract-interpretation/domains/state-abstract-domain.js +26 -37
  28. package/abstract-interpretation/domains/{state-domain-like.d.ts → state-domain.d.ts} +10 -6
  29. package/abstract-interpretation/domains/{state-domain-like.js → state-domain.js} +1 -1
  30. package/abstract-interpretation/value-semantics.d.ts +113 -0
  31. package/abstract-interpretation/value-semantics.js +115 -0
  32. package/benchmark/slicer.js +12 -6
  33. package/benchmark/stats/feature-counts.d.ts +2 -1
  34. package/benchmark/stats/feature-counts.js +25 -1
  35. package/benchmark/stats/stats.d.ts +4 -0
  36. package/benchmark/summarizer/second-phase/graph.js +7 -0
  37. package/cli/repl/commands/repl-parse.js +11 -22
  38. package/cli/repl/parser/slice-query-parser.d.ts +2 -0
  39. package/cli/repl/parser/slice-query-parser.js +1 -0
  40. package/config.d.ts +30 -205
  41. package/config.js +37 -3
  42. package/control-flow/cfg-properties.d.ts +5 -0
  43. package/control-flow/cfg-properties.js +25 -7
  44. package/control-flow/control-flow-graph.d.ts +11 -37
  45. package/control-flow/control-flow-graph.js +33 -77
  46. package/control-flow/semantic-cfg-guided-visitor.d.ts +63 -320
  47. package/control-flow/semantic-cfg-guided-visitor.js +65 -320
  48. package/dataflow/environments/built-in-config.d.ts +2 -0
  49. package/dataflow/environments/built-in-proc-name.d.ts +4 -0
  50. package/dataflow/environments/built-in-proc-name.js +4 -0
  51. package/dataflow/environments/built-in-props.d.ts +192 -82
  52. package/dataflow/environments/built-in-props.js +336 -106
  53. package/dataflow/environments/built-in.d.ts +21 -9
  54. package/dataflow/environments/built-in.js +43 -12
  55. package/dataflow/environments/default-builtin-config.d.ts +3219 -313
  56. package/dataflow/environments/default-builtin-config.js +803 -1012
  57. package/dataflow/environments/environment.d.ts +26 -49
  58. package/dataflow/environments/environment.js +34 -47
  59. package/dataflow/environments/group-generics.d.ts +11 -2
  60. package/dataflow/environments/group-generics.js +22 -3
  61. package/dataflow/environments/identifier.d.ts +106 -6
  62. package/dataflow/environments/identifier.js +19 -1
  63. package/dataflow/environments/query-fn-props.d.ts +16 -8
  64. package/dataflow/environments/query-fn-props.js +45 -21
  65. package/dataflow/environments/resolve-by-name.js +9 -2
  66. package/dataflow/environments/scoping.d.ts +5 -0
  67. package/dataflow/environments/scoping.js +11 -0
  68. package/dataflow/eval/resolve/alias-tracking.d.ts +1 -1
  69. package/dataflow/eval/resolve/alias-tracking.js +24 -6
  70. package/dataflow/eval/resolve/resolve-numbers.d.ts +182 -7
  71. package/dataflow/eval/resolve/resolve-numbers.js +44 -9
  72. package/dataflow/eval/resolve/resolve-strings.d.ts +79 -2
  73. package/dataflow/eval/resolve/resolve-strings.js +16 -7
  74. package/dataflow/eval/resolve/resolve.d.ts +5 -22
  75. package/dataflow/eval/resolve/resolve.js +34 -34
  76. package/dataflow/eval/values/general.d.ts +9 -1
  77. package/dataflow/eval/values/general.js +22 -3
  78. package/dataflow/eval/values/sets/set-constants.d.ts +5 -0
  79. package/dataflow/eval/values/sets/set-constants.js +9 -1
  80. package/dataflow/eval/values/string/string-constants.d.ts +16 -15
  81. package/dataflow/eval/values/string/string-constants.js +59 -27
  82. package/dataflow/extractor.d.ts +2 -1
  83. package/dataflow/extractor.js +16 -4
  84. package/dataflow/fn/argument-roles.d.ts +35 -0
  85. package/dataflow/fn/argument-roles.js +252 -0
  86. package/dataflow/fn/class-declaration.d.ts +148 -0
  87. package/dataflow/fn/class-declaration.js +317 -0
  88. package/dataflow/fn/condition-handlers.d.ts +5 -0
  89. package/dataflow/fn/condition-handlers.js +13 -0
  90. package/dataflow/fn/exceptions-of-function.d.ts +21 -7
  91. package/dataflow/fn/exceptions-of-function.js +74 -43
  92. package/dataflow/fn/frame-reflection.d.ts +46 -0
  93. package/dataflow/fn/frame-reflection.js +169 -0
  94. package/dataflow/fn/function-props.d.ts +32 -0
  95. package/dataflow/fn/function-props.js +160 -0
  96. package/dataflow/fn/higher-order-function.d.ts +23 -5
  97. package/dataflow/fn/higher-order-function.js +64 -18
  98. package/dataflow/fn/strict-function.d.ts +24 -2
  99. package/dataflow/fn/strict-function.js +49 -19
  100. package/dataflow/graph/call-graph.js +10 -2
  101. package/dataflow/graph/df-helper.d.ts +1 -12
  102. package/dataflow/graph/df-helper.js +2 -19
  103. package/dataflow/graph/diff-dataflow-graph.d.ts +1 -1
  104. package/dataflow/graph/diff-dataflow-graph.js +2 -2
  105. package/dataflow/graph/graph.d.ts +39 -188
  106. package/dataflow/graph/graph.js +46 -163
  107. package/dataflow/graph/match-args.d.ts +34 -2
  108. package/dataflow/graph/match-args.js +45 -12
  109. package/dataflow/graph/vertex.d.ts +8 -0
  110. package/dataflow/info.d.ts +7 -5
  111. package/dataflow/info.js +1 -5
  112. package/dataflow/internal/control-flow.js +20 -17
  113. package/dataflow/internal/linker.d.ts +8 -37
  114. package/dataflow/internal/linker.js +22 -55
  115. package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -2
  116. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -8
  117. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +3 -4
  118. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +8 -14
  119. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +43 -50
  120. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.d.ts +4 -1
  121. package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +5 -2
  122. package/dataflow/internal/process/functions/call/built-in/built-in-class-relation.d.ts +23 -0
  123. package/dataflow/internal/process/functions/call/built-in/built-in-class-relation.js +24 -0
  124. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +2 -2
  125. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +2 -1
  126. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +0 -4
  127. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +73 -27
  128. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -11
  129. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +131 -92
  130. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +17 -12
  131. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +187 -99
  132. package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +4 -0
  133. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -0
  134. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +2 -3
  135. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +4 -3
  136. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -1
  137. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -2
  138. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +0 -1
  139. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -1
  140. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.d.ts +31 -0
  141. package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +101 -0
  142. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +2 -1
  143. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +7 -0
  144. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +23 -21
  145. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +1 -2
  146. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +2 -2
  147. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +2 -1
  148. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +22 -1
  149. package/dataflow/internal/process/functions/call/common.d.ts +4 -6
  150. package/dataflow/internal/process/functions/call/common.js +2 -2
  151. package/dataflow/internal/process/functions/call/deferred.d.ts +1 -1
  152. package/dataflow/internal/process/functions/call/deferred.js +2 -2
  153. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +5 -3
  154. package/dataflow/internal/process/functions/call/known-call-handling.js +6 -4
  155. package/dataflow/internal/process/functions/call/named-call-handling.js +19 -13
  156. package/dataflow/internal/process/functions/call/quoted.d.ts +2 -2
  157. package/dataflow/internal/process/functions/call/quoted.js +144 -28
  158. package/dataflow/origin/dfg-get-origin.js +23 -10
  159. package/dataflow/processor.d.ts +2 -1
  160. package/dataflow/processor.js +6 -0
  161. package/documentation/data/interface/doc-writing-code.js +2 -0
  162. package/documentation/doc-util/doc-search.js +1 -1
  163. package/documentation/wiki-absint.d.ts +11 -14
  164. package/documentation/wiki-absint.js +73 -59
  165. package/documentation/wiki-core.js +64 -24
  166. package/documentation/wiki-linter.js +1 -0
  167. package/documentation/wiki-query.js +82 -264
  168. package/documentation/wiki-signature-database.js +17 -5
  169. package/gas.d.ts +91 -47
  170. package/gas.js +97 -13
  171. package/index.d.ts +31 -0
  172. package/index.js +52 -0
  173. package/linter/linter-rules.d.ts +87 -23
  174. package/linter/linter-rules.js +3 -1
  175. package/linter/rules/absolute-path.d.ts +1 -1
  176. package/linter/rules/dataframe-access-validation.d.ts +1 -1
  177. package/linter/rules/dataframe-access-validation.js +10 -8
  178. package/linter/rules/dead-code.d.ts +1 -1
  179. package/linter/rules/deprecated-functions.js +14 -5
  180. package/linter/rules/file-path-validity.d.ts +1 -1
  181. package/linter/rules/naming-convention.d.ts +1 -1
  182. package/linter/rules/naming-convention.js +13 -2
  183. package/linter/rules/network-functions.d.ts +10 -5
  184. package/linter/rules/network-functions.js +48 -36
  185. package/linter/rules/no-leaked-credentials.d.ts +1 -1
  186. package/linter/rules/problematic-inputs.d.ts +1 -1
  187. package/linter/rules/problematic-inputs.js +1 -1
  188. package/linter/rules/seeded-randomness.d.ts +3 -2
  189. package/linter/rules/seeded-randomness.js +7 -3
  190. package/linter/rules/software-has-license.d.ts +1 -1
  191. package/linter/rules/software-has-tests.d.ts +1 -1
  192. package/linter/rules/stop-with-call-arg.d.ts +1 -1
  193. package/linter/rules/syntactically-valid.d.ts +1 -1
  194. package/linter/rules/unclosed-connection.d.ts +3 -3
  195. package/linter/rules/unclosed-connection.js +3 -4
  196. package/linter/rules/undefined-symbol.d.ts +1 -1
  197. package/linter/rules/unescaped-arguments.d.ts +161 -0
  198. package/linter/rules/unescaped-arguments.js +293 -0
  199. package/linter/rules/unused-definition.d.ts +1 -1
  200. package/linter/rules/unused-definition.js +49 -4
  201. package/linter/rules/unused-import.d.ts +1 -1
  202. package/linter/rules/useless-loop.d.ts +1 -1
  203. package/package.json +3 -198
  204. package/project/context/flowr-analyzer-environment-context.d.ts +12 -1
  205. package/project/context/flowr-analyzer-environment-context.js +33 -1
  206. package/project/context/flowr-analyzer-files-context.d.ts +24 -1
  207. package/project/context/flowr-analyzer-files-context.js +42 -21
  208. package/project/context/flowr-analyzer-functions-context.d.ts +8 -0
  209. package/project/context/flowr-analyzer-functions-context.js +2 -0
  210. package/project/context/flowr-analyzer-gas-context.d.ts +9 -1
  211. package/project/context/flowr-analyzer-gas-context.js +21 -0
  212. package/project/context/flowr-file.d.ts +16 -1
  213. package/project/context/flowr-file.js +26 -2
  214. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +19 -20
  215. package/project/plugins/file-plugins/files/flowr-description-file.js +55 -41
  216. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +9 -4
  217. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +11 -3
  218. package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +6 -9
  219. package/project/plugins/file-plugins/files/flowr-manifest-files.js +5 -21
  220. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +11 -12
  221. package/project/plugins/file-plugins/files/flowr-namespace-file.js +48 -61
  222. package/project/plugins/file-plugins/files/flowr-news-file.d.ts +3 -12
  223. package/project/plugins/file-plugins/files/flowr-news-file.js +2 -19
  224. package/project/plugins/file-plugins/files/flowr-rd-file.d.ts +145 -0
  225. package/project/plugins/file-plugins/files/flowr-rd-file.js +676 -0
  226. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +122 -422
  227. package/project/plugins/file-plugins/files/flowr-rda-file.js +517 -1005
  228. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +8 -2
  229. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +10 -1
  230. package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +7 -2
  231. package/project/plugins/file-plugins/files/flowr-sweave-file.js +9 -1
  232. package/project/plugins/file-plugins/files/flowr-sysdata-file.d.ts +17 -0
  233. package/project/plugins/file-plugins/files/flowr-sysdata-file.js +40 -0
  234. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +2 -0
  235. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +3 -1
  236. package/project/plugins/file-plugins/flowr-analyzer-rd-file-plugin.d.ts +58 -0
  237. package/project/plugins/file-plugins/flowr-analyzer-rd-file-plugin.js +95 -0
  238. package/project/plugins/file-plugins/flowr-analyzer-sysdata-file-plugin.d.ts +23 -0
  239. package/project/plugins/file-plugins/flowr-analyzer-sysdata-file-plugin.js +33 -0
  240. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +33 -72
  241. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +17 -15
  242. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +20 -37
  243. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +29 -53
  244. package/project/plugins/package-version-plugins/package.js +2 -1
  245. package/project/plugins/plugin-registry.d.ts +3 -1
  246. package/project/plugins/plugin-registry.js +11 -0
  247. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +20 -4
  248. package/project/sigdb/build.d.ts +9 -15
  249. package/project/sigdb/build.js +101 -42
  250. package/project/sigdb/decode.d.ts +10 -4
  251. package/project/sigdb/decode.js +60 -21
  252. package/project/sigdb/memory-source.d.ts +4 -0
  253. package/project/sigdb/memory-source.js +8 -0
  254. package/project/sigdb/reader.d.ts +57 -100
  255. package/project/sigdb/reader.js +157 -108
  256. package/project/sigdb/schema.d.ts +90 -26
  257. package/project/sigdb/schema.js +12 -6
  258. package/queries/base-query-format.d.ts +7 -0
  259. package/queries/base-query-format.js +29 -0
  260. package/queries/catalog/absint-query/absint-query-executor.js +8 -6
  261. package/queries/catalog/absint-query/absint-query-format.d.ts +20 -9
  262. package/queries/catalog/absint-query/absint-query-format.js +32 -19
  263. package/queries/catalog/call-context-query/call-context-query-executor.js +3 -3
  264. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +1 -1
  265. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
  266. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
  267. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +1 -1
  268. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
  269. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
  270. package/queries/catalog/dependencies-query/dependencies-query-executor.js +33 -7
  271. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
  272. package/queries/catalog/dependencies-query/function-info/derived-functions.d.ts +2 -2
  273. package/queries/catalog/dependencies-query/function-info/derived-functions.js +14 -4
  274. package/queries/catalog/dependencies-query/function-info/read-functions.js +7 -121
  275. package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +1 -1
  276. package/queries/catalog/dependencies-query/function-info/statistics-functions.js +2 -2
  277. package/queries/catalog/dependencies-query/function-info/visualize-functions.js +4 -46
  278. package/queries/catalog/dependencies-query/function-info/write-functions.js +3 -76
  279. package/queries/catalog/dependencies-query/implicit-echo.js +2 -2
  280. package/queries/catalog/dependencies-query/link-devices.d.ts +2 -2
  281. package/queries/catalog/dependencies-query/link-devices.js +6 -7
  282. package/queries/catalog/dice-query/dice-query-executor.js +1 -1
  283. package/queries/catalog/dice-query/dice-query-format.d.ts +1 -1
  284. package/queries/catalog/does-call-query/does-call-query-executor.js +4 -0
  285. package/queries/catalog/does-call-query/does-call-query-format.d.ts +7 -1
  286. package/queries/catalog/files-query/files-query-format.d.ts +1 -1
  287. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +1 -1
  288. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
  289. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
  290. package/queries/catalog/input-sources-query/input-source-functions.d.ts +1 -1
  291. package/queries/catalog/input-sources-query/input-source-functions.js +2 -2
  292. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +7 -17
  293. package/queries/catalog/input-sources-query/input-sources-query-format.js +11 -27
  294. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +1 -1
  295. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +3 -8
  296. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -11
  297. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.d.ts +4 -0
  298. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +60 -0
  299. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.d.ts +35 -0
  300. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +63 -0
  301. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -6
  302. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +3 -8
  303. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -11
  304. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +3 -8
  305. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -12
  306. package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
  307. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
  308. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
  309. package/queries/catalog/project-query/project-query-format.d.ts +1 -1
  310. package/queries/catalog/provenance-query/provenance-query-format.d.ts +3 -8
  311. package/queries/catalog/provenance-query/provenance-query-format.js +2 -14
  312. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
  313. package/queries/catalog/search-query/search-query-format.d.ts +1 -1
  314. package/queries/catalog/signature-query/signature-query-executor.d.ts +5 -10
  315. package/queries/catalog/signature-query/signature-query-executor.js +87 -93
  316. package/queries/catalog/signature-query/signature-query-format.d.ts +20 -5
  317. package/queries/catalog/signature-query/signature-query-format.js +16 -4
  318. package/queries/catalog/signature-query/signature-query-render.js +18 -4
  319. package/queries/catalog/slice-query-options.d.ts +14 -0
  320. package/queries/catalog/slice-query-options.js +15 -0
  321. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +2 -1
  322. package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -2
  323. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -3
  324. package/queries/catalog/static-slice-query/static-slice-query-format.js +7 -5
  325. package/queries/query-function-filter.d.ts +8 -3
  326. package/queries/query-function-filter.js +16 -6
  327. package/queries/query.d.ts +38 -38
  328. package/queries/query.js +30 -4
  329. package/r-bridge/lang-4.x/ast/model/model.d.ts +5 -0
  330. package/r-bridge/lang-4.x/ast/model/model.js +14 -0
  331. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +1 -0
  332. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +1 -0
  333. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +1 -0
  334. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +1 -0
  335. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +1 -0
  336. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +1 -0
  337. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -0
  338. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +1 -0
  339. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +1 -0
  340. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +1 -0
  341. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +1 -0
  342. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +1 -0
  343. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +1 -0
  344. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +1 -0
  345. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +1 -0
  346. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +1 -0
  347. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -0
  348. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +1 -0
  349. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +1 -0
  350. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +1 -0
  351. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +1 -0
  352. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +17 -9
  353. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +35 -27
  354. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +33 -22
  355. package/reconstruct/reconstruct.d.ts +9 -20
  356. package/reconstruct/reconstruct.js +66 -28
  357. package/search/flowr-search-filters.d.ts +7 -6
  358. package/search/flowr-search-filters.js +6 -4
  359. package/search/search-executor/search-enrichers.d.ts +10 -10
  360. package/search/search-executor/search-enrichers.js +32 -3
  361. package/search/search-executor/search-transformer.js +15 -23
  362. package/slicing/criterion/parse.js +2 -12
  363. package/slicing/static/slice-call.js +1 -8
  364. package/slicing/static/static-slicer.js +1 -1
  365. package/util/collections/bimap.js +14 -6
  366. package/util/objects.js +16 -17
  367. package/util/r-value.d.ts +5 -4
  368. package/util/record.d.ts +38 -3
  369. package/util/record.js +48 -1
  370. package/util/simple-df/dfg-ascii.js +1 -1
  371. package/util/text/strings.d.ts +5 -0
  372. package/util/text/strings.js +10 -0
  373. package/util/version.js +2 -2
  374. package/abstract-interpretation/absint-visitor.d.ts +0 -223
  375. package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +0 -19
  376. package/abstract-interpretation/data-frame/mappers/access-mapper.js +0 -151
  377. package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +0 -287
  378. package/abstract-interpretation/data-frame/mappers/function-mapper.js +0 -1096
  379. package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +0 -15
  380. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +0 -207
  381. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +0 -6
  382. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +0 -25
  383. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +0 -31
  384. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +0 -56
@@ -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,34 @@ 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
+ * How many elements of a sequence are worth naming one by one. `1:148066` is a loop bound rather than a set of
113
+ * indices anything asks about, and holding one object per element costs more than the precision is worth, so
114
+ * a longer sequence resolves to {@link Top} instead.
115
+ */
116
+ const MaxSequenceLength = 4096;
117
+ /**
118
+ * The elements `from:to` runs over, counting down whenever `to` is the smaller one, and stopping before it
119
+ * would pass `to` (`1:3.5` ends at `3`). `undefined` for a bound that names no position to count from or to,
120
+ * and for a sequence longer than {@link MaxSequenceLength}.
121
+ */
124
122
  function createNumberSequence(start, end) {
123
+ if (!Number.isFinite(start.num) || !Number.isFinite(end.num)) {
124
+ return undefined;
125
+ }
126
+ else if (Math.floor(Math.abs(end.num - start.num)) + 1 > MaxSequenceLength) {
127
+ return undefined;
128
+ }
129
+ const step = start.num <= end.num ? 1 : -1;
125
130
  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++) {
131
+ for (let i = start.num; step > 0 ? i <= end.num : i >= end.num; i += step) {
129
132
  sequence.push({ ...start, num: i });
130
133
  }
131
- if (start > end) {
132
- sequence.reverse();
133
- }
134
134
  return sequence;
135
135
  }
136
136
  //# sourceMappingURL=resolve.js.map
@@ -1,9 +1,12 @@
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
  */
6
7
  export declare function bottomTopGuard(...a: Lift<unknown>[]): typeof Top | typeof Bottom | undefined;
8
+ /** {@link bottomTopGuard} for a list that is already one, which a spread of many elements could not pass on */
9
+ export declare function bottomTopGuardOf(a: readonly Lift<unknown>[]): typeof Top | typeof Bottom | undefined;
7
10
  /**
8
11
  * Returns a value set, if a is not bottom or top, otherwise undefined.
9
12
  * Useful when working with values returned by {@link Resolve.toValue}
@@ -24,6 +27,11 @@ export declare function soleValue<T extends Value['type']>(this: void, set: Valu
24
27
  * @returns abstract value
25
28
  */
26
29
  export declare function valueFromTsValue(a: unknown): Value;
30
+ /**
31
+ * The interval a number literal stands for. A complex literal keeps its flag, so that nothing folds `2i` as
32
+ * the real number its lexeme starts with.
33
+ */
34
+ export declare function valueFromRNumber(value: RNumberValue): ValueInterval;
27
35
  /**
28
36
  * Converts a constant from an RNode into an abstract value
29
37
  * @param a - RNode constant
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.bottomTopGuard = bottomTopGuard;
4
+ exports.bottomTopGuardOf = bottomTopGuardOf;
4
5
  exports.valueSetGuard = valueSetGuard;
5
6
  exports.soleValue = soleValue;
6
7
  exports.valueFromTsValue = valueFromTsValue;
8
+ exports.valueFromRNumber = valueFromRNumber;
7
9
  exports.valueFromRNodeConstant = valueFromRNodeConstant;
8
10
  const interval_constants_1 = require("./intervals/interval-constants");
9
11
  const logical_constants_1 = require("./logical/logical-constants");
@@ -14,10 +16,15 @@ const r_function_definition_1 = require("../../../r-bridge/lang-4.x/ast/model/no
14
16
  const r_logical_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-logical");
15
17
  const r_number_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-number");
16
18
  const r_string_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
19
+ const scalar_constants_1 = require("./scalar/scalar-constants");
17
20
  /**
18
21
  * Takes n potentially lifted ops and returns `Top` or `Bottom` if any is `Top` or `Bottom`.
19
22
  */
20
23
  function bottomTopGuard(...a) {
24
+ return bottomTopGuardOf(a);
25
+ }
26
+ /** {@link bottomTopGuard} for a list that is already one, which a spread of many elements could not pass on */
27
+ function bottomTopGuardOf(a) {
21
28
  if (a.some(r_value_1.isBottom)) {
22
29
  return r_value_1.Bottom;
23
30
  }
@@ -50,7 +57,11 @@ function soleValue(set, type) {
50
57
  * @returns abstract value
51
58
  */
52
59
  function valueFromTsValue(a) {
53
- if (a === undefined) {
60
+ if (a === r_value_1.Top || a === r_value_1.Bottom) {
61
+ /* what a definition states outright, as `NA` does: R has a value there, flowR has no way to hold it */
62
+ return a;
63
+ }
64
+ else if (a === undefined) {
54
65
  return r_value_1.Bottom;
55
66
  }
56
67
  else if (a === null) {
@@ -70,6 +81,14 @@ function valueFromTsValue(a) {
70
81
  }
71
82
  return r_value_1.Top;
72
83
  }
84
+ /**
85
+ * The interval a number literal stands for. A complex literal keeps its flag, so that nothing folds `2i` as
86
+ * the real number its lexeme starts with.
87
+ */
88
+ function valueFromRNumber(value) {
89
+ const scalar = (0, scalar_constants_1.getScalarFromInteger)(value.num, !value.complexNumber && Number.isInteger(value.num), value.complexNumber);
90
+ return (0, interval_constants_1.intervalFromValues)(scalar, scalar);
91
+ }
73
92
  /**
74
93
  * Converts a constant from an RNode into an abstract value
75
94
  * @param a - RNode constant
@@ -77,10 +96,10 @@ function valueFromTsValue(a) {
77
96
  */
78
97
  function valueFromRNodeConstant(a) {
79
98
  if (r_string_1.RString.is(a)) {
80
- return (0, string_constants_1.stringFrom)(a.content.str);
99
+ return string_constants_1.RStringLiteral.value(a.content) ?? r_value_1.Top;
81
100
  }
82
101
  else if (r_number_1.RNumber.is(a)) {
83
- return (0, interval_constants_1.intervalFrom)(a.content.num, a.content.num);
102
+ return valueFromRNumber(a.content);
84
103
  }
85
104
  else if (r_logical_1.RLogical.is(a)) {
86
105
  return a.content.valueOf() ? logical_constants_1.ValueLogicalTrue : logical_constants_1.ValueLogicalFalse;
@@ -4,6 +4,11 @@ import { type Lift, type Value, type ValueSet, Top } from '../r-value';
4
4
  * @see {@link isSet} - to check whether a value is a set
5
5
  */
6
6
  export declare function setFrom<V extends Value[]>(...elements: V): Lift<ValueSet<Value[]>>;
7
+ /**
8
+ * {@link setFrom} for elements that are already a list, which a set of many of them could not be spread into.
9
+ * @see {@link isSet} - to check whether a value is a set
10
+ */
11
+ export declare function setOf(elements: readonly Value[]): Lift<ValueSet<Value[]>>;
7
12
  /**
8
13
  * Checks, whether the given value is a set.
9
14
  * @see {@link setFrom} - to create sets
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ValueSetBottom = exports.ValueSetTop = exports.ValueEmptySet = void 0;
4
4
  exports.setFrom = setFrom;
5
+ exports.setOf = setOf;
5
6
  exports.isSet = isSet;
6
7
  const general_1 = require("../general");
7
8
  const r_value_1 = require("../r-value");
@@ -15,10 +16,17 @@ function flattenSetElements(s) {
15
16
  * @see {@link isSet} - to check whether a value is a set
16
17
  */
17
18
  function setFrom(...elements) {
19
+ return setOf(elements);
20
+ }
21
+ /**
22
+ * {@link setFrom} for elements that are already a list, which a set of many of them could not be spread into.
23
+ * @see {@link isSet} - to check whether a value is a set
24
+ */
25
+ function setOf(elements) {
18
26
  const vals = elements.flatMap(e => {
19
27
  return e.type === 'set' ? flattenSetElements(e.elements) : e;
20
28
  });
21
- return (0, general_1.bottomTopGuard)(...vals) ?? {
29
+ return (0, general_1.bottomTopGuardOf)(vals) ?? {
22
30
  type: 'set',
23
31
  elements: vals
24
32
  };
@@ -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) {