@eagleoutice/flowr 2.12.3 → 2.13.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 (321) hide show
  1. package/README.md +42 -95
  2. package/abstract-interpretation/data-frame/dataframe-domain.d.ts +3 -3
  3. package/abstract-interpretation/data-frame/dataframe-domain.js +14 -6
  4. package/abstract-interpretation/data-frame/semantics.js +12 -16
  5. package/abstract-interpretation/domains/abstract-domain.d.ts +46 -44
  6. package/abstract-interpretation/domains/abstract-domain.js +146 -6
  7. package/abstract-interpretation/domains/bounded-set-domain.d.ts +16 -25
  8. package/abstract-interpretation/domains/bounded-set-domain.js +22 -69
  9. package/abstract-interpretation/domains/interval-domain.d.ts +27 -36
  10. package/abstract-interpretation/domains/interval-domain.js +111 -146
  11. package/abstract-interpretation/domains/lattice.d.ts +3 -3
  12. package/abstract-interpretation/domains/multi-value-state-domain.js +3 -3
  13. package/abstract-interpretation/domains/partial-product-domain.d.ts +12 -19
  14. package/abstract-interpretation/domains/partial-product-domain.js +21 -54
  15. package/abstract-interpretation/domains/positive-interval-domain.d.ts +8 -12
  16. package/abstract-interpretation/domains/positive-interval-domain.js +21 -50
  17. package/abstract-interpretation/domains/product-domain.d.ts +1 -1
  18. package/abstract-interpretation/domains/product-domain.js +4 -4
  19. package/abstract-interpretation/domains/set-range-domain.d.ts +60 -56
  20. package/abstract-interpretation/domains/set-range-domain.js +141 -200
  21. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +17 -23
  22. package/abstract-interpretation/domains/set-upper-bound-domain.js +59 -103
  23. package/abstract-interpretation/domains/singleton-domain.d.ts +15 -18
  24. package/abstract-interpretation/domains/singleton-domain.js +33 -72
  25. package/abstract-interpretation/domains/state-abstract-domain.d.ts +12 -16
  26. package/abstract-interpretation/domains/state-abstract-domain.js +36 -126
  27. package/abstract-interpretation/domains/state-domain-like.d.ts +2 -2
  28. package/abstract-interpretation/domains/value-abstract-domain.d.ts +120 -0
  29. package/abstract-interpretation/domains/{satisfiable-domain.js → value-abstract-domain.js} +14 -2
  30. package/benchmark/slicer.d.ts +2 -2
  31. package/benchmark/slicer.js +6 -5
  32. package/cli/common/options.d.ts +20 -0
  33. package/cli/common/options.js +4 -0
  34. package/cli/common/scripts-info.d.ts +20 -0
  35. package/cli/flowr-main-options.d.ts +4 -0
  36. package/cli/flowr-main-options.js +5 -0
  37. package/cli/flowr.d.ts +5 -0
  38. package/cli/flowr.js +15 -7
  39. package/cli/repl/commands/repl-commands.d.ts +8 -0
  40. package/cli/repl/commands/repl-commands.js +16 -3
  41. package/cli/repl/commands/repl-query.js +50 -20
  42. package/cli/repl/commands/repl-signature.js +2 -2
  43. package/cli/repl/core.d.ts +14 -5
  44. package/cli/repl/core.js +32 -17
  45. package/cli/repl/parser/slice-query-parser.d.ts +69 -8
  46. package/cli/repl/parser/slice-query-parser.js +82 -13
  47. package/cli/repl/path-input.d.ts +6 -0
  48. package/cli/repl/path-input.js +41 -0
  49. package/cli/repl/print-version.js +3 -5
  50. package/cli/slicer-app.d.ts +4 -0
  51. package/cli/slicer-app.js +4 -2
  52. package/config.d.ts +56 -6
  53. package/config.js +134 -12
  54. package/control-flow/control-flow-graph.d.ts +3 -2
  55. package/control-flow/control-flow-graph.js +34 -14
  56. package/control-flow/semantic-cfg-guided-visitor.d.ts +3 -0
  57. package/control-flow/semantic-cfg-guided-visitor.js +3 -0
  58. package/core/steps/all/static-slicing/10-reconstruct.d.ts +6 -0
  59. package/core/steps/all/static-slicing/10-reconstruct.js +3 -1
  60. package/data/r-base-packages.generated.d.ts +1 -1
  61. package/data/r-base-packages.generated.js +3 -3
  62. package/data/sigdb/sigdb.remote.json +53 -53
  63. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  64. package/dataflow/environments/built-in-proc-name.js +2 -0
  65. package/dataflow/environments/built-in.d.ts +2 -0
  66. package/dataflow/environments/built-in.js +2 -0
  67. package/dataflow/environments/default-builtin-config.d.ts +3 -5
  68. package/dataflow/environments/default-builtin-config.js +2 -2
  69. package/dataflow/environments/environment.d.ts +9 -0
  70. package/dataflow/environments/environment.js +28 -7
  71. package/dataflow/environments/identifier.d.ts +1 -2
  72. package/dataflow/environments/identifier.js +1 -5
  73. package/dataflow/extractor.js +1 -2
  74. package/dataflow/graph/dataflowgraph-builder.js +42 -3
  75. package/dataflow/graph/df-helper.d.ts +15 -0
  76. package/dataflow/graph/df-helper.js +20 -0
  77. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +4 -4
  78. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +7 -0
  79. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +13 -0
  80. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +4 -0
  81. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +57 -11
  82. package/dataflow/internal/process/functions/call/built-in/built-in-load.d.ts +12 -0
  83. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +233 -0
  84. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +2 -1
  85. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -3
  86. package/documentation/data/faq/faqs.js +12 -1
  87. package/documentation/doc-readme.js +1 -1
  88. package/documentation/doc-util/doc-files.d.ts +2 -2
  89. package/documentation/doc-util/doc-files.js +4 -7
  90. package/documentation/doc-util/doc-query.d.ts +12 -9
  91. package/documentation/doc-util/doc-query.js +63 -28
  92. package/documentation/wiki-absint.js +1 -4
  93. package/documentation/wiki-analyzer.js +8 -3
  94. package/documentation/wiki-cfg.js +3 -2
  95. package/documentation/wiki-dataflow-graph.js +14 -4
  96. package/documentation/wiki-interface.js +30 -16
  97. package/documentation/wiki-mk/doc-maker.js +1 -1
  98. package/documentation/wiki-query.js +190 -30
  99. package/documentation/wiki-signature-database.d.ts +1 -1
  100. package/documentation/wiki-signature-database.js +53 -27
  101. package/linter/linter-output.d.ts +24 -0
  102. package/linter/linter-output.js +117 -0
  103. package/linter/linter-rules.d.ts +2 -4
  104. package/linter/rules/dataframe-access-validation.js +4 -4
  105. package/linter/rules/deprecated-functions.d.ts +2 -4
  106. package/linter/rules/deprecated-functions.js +58 -3
  107. package/linter/rules/undefined-symbol.js +18 -10
  108. package/linter/rules/unused-definition.js +24 -0
  109. package/package.json +5 -2
  110. package/project/context/flowr-analyzer-context.d.ts +61 -1
  111. package/project/context/flowr-analyzer-context.js +124 -3
  112. package/project/context/flowr-analyzer-dependencies-context.d.ts +32 -7
  113. package/project/context/flowr-analyzer-dependencies-context.js +33 -3
  114. package/project/context/flowr-analyzer-files-context.d.ts +40 -0
  115. package/project/context/flowr-analyzer-files-context.js +171 -14
  116. package/project/context/flowr-analyzer-loading-order-context.d.ts +6 -0
  117. package/project/context/flowr-analyzer-loading-order-context.js +20 -0
  118. package/project/context/flowr-analyzer-meta-context.d.ts +92 -10
  119. package/project/context/flowr-analyzer-meta-context.js +64 -23
  120. package/project/context/flowr-file.d.ts +7 -0
  121. package/project/context/flowr-file.js +7 -0
  122. package/project/context/project-kind.d.ts +22 -0
  123. package/project/context/project-kind.js +27 -0
  124. package/project/dependency-version-space.d.ts +168 -0
  125. package/project/dependency-version-space.js +570 -0
  126. package/project/flowr-analyzer-builder.js +1 -1
  127. package/project/flowr-analyzer.d.ts +7 -0
  128. package/project/flowr-analyzer.js +9 -0
  129. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +4 -0
  130. package/project/plugins/file-plugins/files/flowr-description-file.js +7 -0
  131. package/project/plugins/file-plugins/files/flowr-namespace-file.js +5 -1
  132. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +739 -0
  133. package/project/plugins/file-plugins/files/flowr-rda-file.js +2407 -0
  134. package/project/plugins/file-plugins/files/flowr-rproject-file.d.ts +31 -0
  135. package/project/plugins/file-plugins/files/flowr-rproject-file.js +66 -0
  136. package/project/plugins/file-plugins/files/r-fun-tab.d.ts +828 -0
  137. package/project/plugins/file-plugins/files/r-fun-tab.js +1039 -0
  138. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +1 -1
  139. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
  140. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +1 -1
  141. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +1 -1
  142. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +1 -1
  143. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +1 -1
  144. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +1 -1
  145. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.d.ts +1 -1
  146. package/project/plugins/file-plugins/flowr-analyzer-namespace-files-plugin.js +1 -1
  147. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +1 -1
  148. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +1 -1
  149. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.d.ts +26 -0
  150. package/project/plugins/file-plugins/flowr-analyzer-rda-file-plugin.js +38 -0
  151. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.d.ts +17 -0
  152. package/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.js +30 -0
  153. package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.d.ts +22 -0
  154. package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.js +36 -0
  155. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +1 -1
  156. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +1 -1
  157. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +1 -1
  158. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +1 -1
  159. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +3 -4
  160. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +5 -6
  161. package/project/plugins/flowr-analyzer-plugin.js +5 -0
  162. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +1 -1
  163. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +1 -1
  164. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.d.ts +14 -0
  165. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-implicit-sources-plugin.js +53 -0
  166. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +1 -1
  167. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.d.ts +15 -0
  168. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-rprofile-plugin.js +33 -0
  169. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.d.ts +1 -1
  170. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +18 -13
  171. package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.d.ts +13 -0
  172. package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.js +32 -0
  173. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +1 -1
  174. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
  175. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +8 -1
  176. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +70 -7
  177. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.d.ts +1 -1
  178. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -1
  179. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +1 -1
  180. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.d.ts +18 -0
  181. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-session-info-plugin.js +62 -0
  182. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +4 -1
  183. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +5 -13
  184. package/project/plugins/package-version-plugins/package.d.ts +4 -1
  185. package/project/plugins/package-version-plugins/package.js +8 -5
  186. package/project/plugins/plugin-registry.d.ts +11 -3
  187. package/project/plugins/plugin-registry.js +24 -5
  188. package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.d.ts +51 -0
  189. package/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.js +101 -0
  190. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +10 -5
  191. package/project/sigdb/build.js +12 -2
  192. package/project/sigdb/decode.d.ts +7 -0
  193. package/project/sigdb/decode.js +35 -4
  194. package/project/sigdb/decompress.d.ts +2 -0
  195. package/project/sigdb/decompress.js +5 -0
  196. package/project/sigdb/manifest.d.ts +5 -0
  197. package/project/sigdb/manifest.js +37 -6
  198. package/project/sigdb/reader.d.ts +82 -2
  199. package/project/sigdb/reader.js +226 -14
  200. package/project/sigdb/schema.d.ts +31 -5
  201. package/project/sigdb/schema.js +7 -3
  202. package/project/sigdb/{version.d.ts → sigdb-version.d.ts} +21 -1
  203. package/project/sigdb/sigdb-version.js +119 -0
  204. package/queries/catalog/absint-query/absint-query-format.d.ts +2 -0
  205. package/queries/catalog/absint-query/absint-query-format.js +2 -0
  206. package/queries/catalog/call-context-query/call-context-query-executor.js +30 -3
  207. package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -0
  208. package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
  209. package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
  210. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +6 -0
  211. package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -0
  212. package/queries/catalog/call-graph-query/expand-library-internals.d.ts +19 -0
  213. package/queries/catalog/call-graph-query/expand-library-internals.js +59 -0
  214. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -0
  215. package/queries/catalog/cluster-query/cluster-query-format.js +1 -0
  216. package/queries/catalog/config-query/config-query-executor.js +17 -5
  217. package/queries/catalog/config-query/config-query-format.d.ts +19 -3
  218. package/queries/catalog/config-query/config-query-format.js +258 -98
  219. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -0
  220. package/queries/catalog/control-flow-query/control-flow-query-format.js +1 -0
  221. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -0
  222. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -0
  223. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -0
  224. package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -0
  225. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -7
  226. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +13 -1
  227. package/queries/catalog/dependencies-query/dependencies-query-format.js +117 -17
  228. package/queries/catalog/dice-query/dice-query-executor.js +6 -9
  229. package/queries/catalog/dice-query/dice-query-format.d.ts +4 -5
  230. package/queries/catalog/dice-query/dice-query-format.js +10 -6
  231. package/queries/catalog/does-call-query/does-call-query-executor.js +15 -2
  232. package/queries/catalog/does-call-query/does-call-query-format.d.ts +8 -0
  233. package/queries/catalog/does-call-query/does-call-query-format.js +4 -1
  234. package/queries/catalog/files-query/files-query-format.d.ts +2 -0
  235. package/queries/catalog/files-query/files-query-format.js +2 -0
  236. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.d.ts +6 -0
  237. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +293 -0
  238. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +121 -0
  239. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +345 -0
  240. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -0
  241. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -0
  242. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -0
  243. package/queries/catalog/id-map-query/id-map-query-format.js +1 -0
  244. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
  245. package/queries/catalog/input-sources-query/input-sources-query-format.js +2 -0
  246. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
  247. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -0
  248. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
  249. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +2 -0
  250. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -0
  251. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +2 -0
  252. package/queries/catalog/linter-query/linter-query-executor.js +11 -2
  253. package/queries/catalog/linter-query/linter-query-format.d.ts +9 -4
  254. package/queries/catalog/linter-query/linter-query-format.js +44 -21
  255. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
  256. package/queries/catalog/location-map-query/location-map-query-format.js +2 -0
  257. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -0
  258. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -0
  259. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
  260. package/queries/catalog/origin-query/origin-query-format.js +2 -0
  261. package/queries/catalog/project-query/project-query-executor.d.ts +0 -15
  262. package/queries/catalog/project-query/project-query-executor.js +19 -62
  263. package/queries/catalog/project-query/project-query-format.d.ts +7 -18
  264. package/queries/catalog/project-query/project-query-format.js +3 -18
  265. package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
  266. package/queries/catalog/provenance-query/provenance-query-format.js +2 -0
  267. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
  268. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -0
  269. package/queries/catalog/search-query/search-query-format.d.ts +1 -0
  270. package/queries/catalog/search-query/search-query-format.js +1 -0
  271. package/queries/catalog/signature-query/signature-query-executor.d.ts +5 -0
  272. package/queries/catalog/signature-query/signature-query-executor.js +267 -57
  273. package/queries/catalog/signature-query/signature-query-format.d.ts +37 -6
  274. package/queries/catalog/signature-query/signature-query-format.js +41 -5
  275. package/queries/catalog/signature-query/signature-query-render.js +48 -6
  276. package/queries/catalog/slice-query-options.d.ts +49 -0
  277. package/queries/catalog/slice-query-options.js +50 -0
  278. package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -12
  279. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +4 -15
  280. package/queries/catalog/static-slice-query/static-slice-query-format.js +9 -10
  281. package/queries/query-print.js +3 -1
  282. package/queries/query.d.ts +62 -2
  283. package/queries/query.js +9 -2
  284. package/r-bridge/data/data.d.ts +16 -0
  285. package/r-bridge/data/data.js +20 -0
  286. package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -0
  287. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +2 -1
  288. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +2 -1
  289. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +19 -16
  290. package/reconstruct/reconstruct.d.ts +18 -1
  291. package/reconstruct/reconstruct.js +42 -19
  292. package/slicing/criterion/parse.d.ts +4 -0
  293. package/slicing/criterion/parse.js +4 -0
  294. package/slicing/static/slice-call.js +17 -9
  295. package/slicing/static/static-slicer.d.ts +1 -1
  296. package/slicing/static/static-slicer.js +5 -4
  297. package/util/files.d.ts +19 -1
  298. package/util/files.js +45 -3
  299. package/util/glob.d.ts +19 -0
  300. package/util/glob.js +67 -0
  301. package/util/log.d.ts +12 -0
  302. package/util/log.js +17 -1
  303. package/util/logic.d.ts +6 -0
  304. package/util/logic.js +31 -1
  305. package/util/mermaid/dfg.js +17 -12
  306. package/util/mermaid/mermaid.js +2 -2
  307. package/util/objects.d.ts +5 -0
  308. package/util/objects.js +8 -0
  309. package/util/r-version.d.ts +9 -1
  310. package/util/r-version.js +27 -2
  311. package/util/schema.d.ts +18 -0
  312. package/util/schema.js +102 -4
  313. package/util/text/ansi.d.ts +4 -0
  314. package/util/text/ansi.js +27 -3
  315. package/util/text/strings.d.ts +9 -0
  316. package/util/text/strings.js +29 -0
  317. package/util/version.js +79 -6
  318. package/abstract-interpretation/domains/satisfiable-domain.d.ts +0 -29
  319. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +0 -22
  320. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +0 -52
  321. package/project/sigdb/version.js +0 -55
@@ -6,15 +6,13 @@ const set_1 = require("../../util/collections/set");
6
6
  const logic_1 = require("../../util/logic");
7
7
  const abstract_domain_1 = require("./abstract-domain");
8
8
  const lattice_1 = require("./lattice");
9
- const satisfiable_domain_1 = require("./satisfiable-domain");
10
- /* eslint-disable @typescript-eslint/unified-signatures */
11
- /** The Top element of the set range domain with an empty set as minimum set and {@link Top} as range set */
12
- exports.SetRangeTop = { min: new Set(), range: lattice_1.Top };
13
- const DefaultLimit = { min: abstract_domain_1.DEFAULT_INFERENCE_LIMIT, range: abstract_domain_1.DEFAULT_INFERENCE_LIMIT };
9
+ const value_abstract_domain_1 = require("./value-abstract-domain");
10
+ /** The Top element of the set range domain with an empty set as must set and {@link Top} as may set */
11
+ exports.SetRangeTop = { must: new Set(), may: lattice_1.Top };
14
12
  /**
15
- * The set range abstract domain as range of possible value sets with a minimum set of values and a range of possible additional values
13
+ * The set range abstract domain as range of possible value sets with a set of values that must be present and a set of values that may be present
16
14
  * (similar to an interval-like structure with a lower bound and a difference to the upper bound).
17
- * The Bottom element is defined as {@link Bottom} symbol and the Top element is defined as the range `[∅, Top]` where the minimum set is the empty set and the range is {@link Top}.
15
+ * The Bottom element is defined as {@link Bottom} symbol and the Top element is defined as the range `[∅, Top]` where the must set is the empty set and the may set is {@link Top}.
18
16
  * @template T - Type of the values in the sets in the abstract domain
19
17
  * @template Value - Type of the constraint in the abstract domain (Top, Bottom, or an actual value)
20
18
  */
@@ -22,19 +20,19 @@ class SetRangeDomain extends abstract_domain_1.AbstractDomain {
22
20
  limit;
23
21
  setType;
24
22
  /**
25
- * @param limit - A limit for the maximum number of elements to store in the minimum set and maximum set before over-approximation
23
+ * @param limit - A limit for the maximum number of elements to store in the must set and may set before over-approximation
26
24
  * @param newSet - An optional set constructor for the domain elements if the type `T` is not storable in a HashSet
27
25
  */
28
- constructor(value, limit = DefaultLimit, setType = Set) {
29
- limit = typeof limit === 'number' ? { min: limit, range: limit } : limit;
26
+ constructor(value, limit = abstract_domain_1.DEFAULT_INFERENCE_LIMIT, setType = Set) {
27
+ limit = typeof limit === 'number' ? { must: limit, may: limit } : limit;
30
28
  if (value !== lattice_1.Bottom) {
31
- const minSet = new setType(value.min);
32
- const rangeSet = value.range === lattice_1.Top ? lattice_1.Top : new setType(value.range);
33
- const minExceeds = minSet.size > limit.min;
34
- const rangeExceeds = rangeSet === lattice_1.Top || rangeSet.size > limit.range || minSet.size + rangeSet.size > limit.min + limit.range;
35
- const min = minExceeds ? new setType(minSet.values().take(limit.min)) : minSet;
36
- const range = rangeExceeds ? lattice_1.Top : minSet.union(rangeSet).difference(min);
37
- super({ min, range });
29
+ const mustSet = new setType(value.must);
30
+ const maySet = value.may === lattice_1.Top ? lattice_1.Top : new setType(value.may);
31
+ const mustExceeds = mustSet.size > limit.must;
32
+ const mayExceeds = maySet === lattice_1.Top || maySet.size > limit.may || mustSet.size + maySet.size > limit.must + limit.may;
33
+ const must = mustExceeds ? new setType(mustSet.values().take(limit.must)) : mustSet;
34
+ const may = mayExceeds ? lattice_1.Top : mustSet.union(maySet).difference(must);
35
+ super({ must, may });
38
36
  }
39
37
  else {
40
38
  super(value);
@@ -46,85 +44,65 @@ class SetRangeDomain extends abstract_domain_1.AbstractDomain {
46
44
  return new SetRangeDomain(value, this.limit, this.setType);
47
45
  }
48
46
  /**
49
- * The minimum set (lower bound) of the set range representing all values that must exist (subset of {@link upper}).
47
+ * The set of values that must be present in the set.
50
48
  */
51
- lower() {
52
- if (this.value === lattice_1.Bottom) {
53
- return lattice_1.Bottom;
54
- }
55
- return this.value.min;
49
+ get must() {
50
+ return (this.isValue() ? this.value.must : lattice_1.Bottom);
56
51
  }
57
52
  /**
58
- * The maximum set (upper bound) of the set range representing all values that can possibly exist (union of {@link lower} and range).
53
+ * The set of values that may be present in the set (can be {@link Top}).
59
54
  */
55
+ get may() {
56
+ return (this.isValue() ? this.value.may : lattice_1.Bottom);
57
+ }
58
+ lower() {
59
+ return this.must;
60
+ }
60
61
  upper() {
61
- if (this.value === lattice_1.Bottom) {
62
- return lattice_1.Bottom;
63
- }
64
- else if (this.value.range === lattice_1.Top) {
65
- return lattice_1.Top;
62
+ return this.isFinite() ? this.must.union(this.may) : this.may;
63
+ }
64
+ from(...values) {
65
+ if (values.length === 0) {
66
+ return this.bottom();
66
67
  }
67
- return this.value.min.union(this.value.range);
68
+ const sets = values.map(value => new Set(value));
69
+ const must = sets.reduce((result, set) => result.intersection(set));
70
+ const may = sets.reduce((result, set) => result.union(set)).difference(must);
71
+ return this.create({ must, may });
68
72
  }
69
73
  static top(limit, setType) {
70
- return new SetRangeDomain(exports.SetRangeTop, limit, setType);
74
+ return new this(exports.SetRangeTop, limit, setType);
71
75
  }
72
76
  static bottom(limit, setType) {
73
- return new SetRangeDomain(lattice_1.Bottom, limit, setType);
77
+ return new this(lattice_1.Bottom, limit, setType);
74
78
  }
75
- static abstract(concrete, limit, setType) {
76
- if (concrete === lattice_1.Top) {
77
- return SetRangeDomain.top(limit, setType);
78
- }
79
- else if (concrete.size === 0) {
80
- return SetRangeDomain.bottom(limit, setType);
79
+ static from(values, limit, setType) {
80
+ values = !Array.isArray(values) ? [values] : values.every(value => value instanceof Set || Array.isArray(value)) ? values : [values];
81
+ if (values.length === 0) {
82
+ return this.bottom();
81
83
  }
82
- const lower = concrete.values().reduce((result, set) => result.intersection(set));
83
- const upper = concrete.values().reduce((result, set) => result.union(set));
84
- return new SetRangeDomain({ min: lower, range: upper.difference(lower) }, limit, setType);
84
+ const sets = values.map(value => new Set(value));
85
+ const must = sets.reduce((result, set) => result.intersection(set));
86
+ const may = sets.reduce((result, set) => result.union(set)).difference(must);
87
+ return new this({ must, may }, limit, setType);
85
88
  }
86
89
  top() {
87
- return SetRangeDomain.top(this.limit, this.setType);
90
+ return this.create(exports.SetRangeTop);
88
91
  }
89
92
  bottom() {
90
- return SetRangeDomain.bottom(this.limit, this.setType);
93
+ return this.create(lattice_1.Bottom);
91
94
  }
92
- equals(other) {
93
- if (this.value === other.value) {
94
- return true;
95
- }
96
- else if (this.value === lattice_1.Bottom || other.value === lattice_1.Bottom || !(0, set_1.setEquals)(this.value.min, other.value.min)) {
97
- return false;
98
- }
99
- else if (this.value.range === other.value.range) {
100
- return true;
101
- }
102
- return this.value.range !== lattice_1.Top && other.value.range !== lattice_1.Top && (0, set_1.setEquals)(this.value.range, other.value.range);
95
+ equalsValue(other) {
96
+ return (0, set_1.setEquals)(this.must, other.must) && (this.may === other.may || (this.may !== lattice_1.Top && other.may !== lattice_1.Top && (0, set_1.setEquals)(this.may, other.may)));
103
97
  }
104
- leq(other) {
98
+ leqValue(other) {
105
99
  const thisLower = this.lower(), thisUpper = this.upper();
106
100
  const otherLower = other.lower(), otherUpper = other.upper();
107
- if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom) {
108
- return true;
109
- }
110
- else if (otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom || !otherLower.isSubsetOf(thisLower)) {
111
- return false;
112
- }
113
- else if (otherUpper === lattice_1.Top) {
114
- return true;
115
- }
116
- return thisUpper !== lattice_1.Top && thisUpper.isSubsetOf(otherUpper);
101
+ return otherLower.isSubsetOf(thisLower) && (otherUpper === lattice_1.Top || (thisUpper !== lattice_1.Top && thisUpper.isSubsetOf(otherUpper)));
117
102
  }
118
- join(other) {
119
- other = other instanceof SetRangeDomain ? other : this.create(other);
103
+ joinValue(other) {
120
104
  const thisLower = this.lower(), thisUpper = this.upper();
121
105
  const otherLower = other.lower(), otherUpper = other.upper();
122
- if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom) {
123
- return this.create(other.value);
124
- }
125
- else if (otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
126
- return this.create(this.value);
127
- }
128
106
  const joinLower = thisLower.intersection(otherLower);
129
107
  let joinUpper;
130
108
  if (thisUpper === lattice_1.Top || otherUpper === lattice_1.Top) {
@@ -133,15 +111,14 @@ class SetRangeDomain extends abstract_domain_1.AbstractDomain {
133
111
  else {
134
112
  joinUpper = thisUpper.union(otherUpper);
135
113
  }
136
- return this.create({ min: joinLower, range: joinUpper === lattice_1.Top ? lattice_1.Top : joinUpper.difference(joinLower) });
114
+ return this.create({
115
+ must: joinLower,
116
+ may: joinUpper === lattice_1.Top ? lattice_1.Top : joinUpper.difference(joinLower)
117
+ });
137
118
  }
138
- meet(other) {
139
- other = other instanceof SetRangeDomain ? other : this.create(other);
119
+ meetValue(other) {
140
120
  const thisLower = this.lower(), thisUpper = this.upper();
141
121
  const otherLower = other.lower(), otherUpper = other.upper();
142
- if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom || otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
143
- return this.bottom();
144
- }
145
122
  const meetLower = thisLower.union(otherLower);
146
123
  let meetUpper;
147
124
  if (thisUpper === lattice_1.Top) {
@@ -156,21 +133,18 @@ class SetRangeDomain extends abstract_domain_1.AbstractDomain {
156
133
  if (meetUpper !== lattice_1.Top && !meetLower.isSubsetOf(meetUpper)) {
157
134
  return this.bottom();
158
135
  }
159
- return this.create({ min: meetLower, range: meetUpper === lattice_1.Top ? lattice_1.Top : meetUpper.difference(meetLower) });
136
+ return this.create({
137
+ must: meetLower,
138
+ may: meetUpper === lattice_1.Top ? lattice_1.Top : meetUpper.difference(meetLower)
139
+ });
160
140
  }
161
- /**
162
- * Creates the union of this abstract value and another abstract value by creating the union of the minimum and maximum set, respectively.
163
- */
164
141
  union(other) {
165
142
  other = other instanceof SetRangeDomain ? other : this.create(other);
143
+ if (!this.isValue() || !other.isValue()) {
144
+ return this.bottom();
145
+ }
166
146
  const thisLower = this.lower(), thisUpper = this.upper();
167
147
  const otherLower = other.lower(), otherUpper = other.upper();
168
- if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom) {
169
- return this.create(other.value);
170
- }
171
- else if (otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
172
- return this.create(this.value);
173
- }
174
148
  const unionLower = thisLower.union(otherLower);
175
149
  let unionUpper;
176
150
  if (thisUpper === lattice_1.Top || otherUpper === lattice_1.Top) {
@@ -179,18 +153,18 @@ class SetRangeDomain extends abstract_domain_1.AbstractDomain {
179
153
  else {
180
154
  unionUpper = thisUpper.union(otherUpper);
181
155
  }
182
- return this.create({ min: unionLower, range: unionUpper === lattice_1.Top ? lattice_1.Top : unionUpper.difference(unionLower) });
156
+ return this.create({
157
+ must: unionLower,
158
+ may: unionUpper === lattice_1.Top ? lattice_1.Top : unionUpper.difference(unionLower)
159
+ });
183
160
  }
184
- /**
185
- * Creates the intersection of this abstract value and another abstract value by creating the intersection of the minimum and maximum set, respectively.
186
- */
187
161
  intersect(other) {
188
162
  other = other instanceof SetRangeDomain ? other : this.create(other);
189
- const thisLower = this.lower(), thisUpper = this.upper();
190
- const otherLower = other.lower(), otherUpper = other.upper();
191
- if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom || otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
163
+ if (!this.isValue() || !other.isValue()) {
192
164
  return this.bottom();
193
165
  }
166
+ const thisLower = this.lower(), thisUpper = this.upper();
167
+ const otherLower = other.lower(), otherUpper = other.upper();
194
168
  const intersectLower = thisLower.intersection(otherLower);
195
169
  let intersectUpper;
196
170
  if (thisUpper === lattice_1.Top) {
@@ -202,82 +176,66 @@ class SetRangeDomain extends abstract_domain_1.AbstractDomain {
202
176
  else {
203
177
  intersectUpper = thisUpper.intersection(otherUpper);
204
178
  }
205
- return this.create({ min: intersectLower, range: intersectUpper === lattice_1.Top ? lattice_1.Top : intersectUpper.difference(intersectLower) });
179
+ return this.create({
180
+ must: intersectLower,
181
+ may: intersectUpper === lattice_1.Top ? lattice_1.Top : intersectUpper.difference(intersectLower)
182
+ });
206
183
  }
207
- /**
208
- * Subtracts another abstract value from the current abstract value by removing all elements of the other abstract value from the current abstract value.
209
- */
210
184
  subtract(other) {
211
185
  other = other instanceof SetRangeDomain ? other : this.create(other);
212
- const thisLower = this.lower(), thisUpper = this.upper();
213
- const otherLower = other.lower(), otherUpper = other.upper();
214
- if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom) {
186
+ if (!this.isValue() || !other.isValue()) {
215
187
  return this.bottom();
216
188
  }
217
- else if (otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
218
- return this.create(this.value);
219
- }
220
- let subLower;
189
+ const thisLower = this.lower(), thisUpper = this.upper();
190
+ const otherLower = other.lower(), otherUpper = other.upper();
191
+ let subtractLower;
221
192
  if (otherUpper === lattice_1.Top) {
222
- subLower = new Set();
193
+ subtractLower = new Set();
223
194
  }
224
195
  else {
225
- subLower = thisLower.difference(otherUpper);
196
+ subtractLower = thisLower.difference(otherUpper);
226
197
  }
227
- let subUpper;
198
+ let subtractUpper;
228
199
  if (thisUpper === lattice_1.Top) {
229
- subUpper = lattice_1.Top;
200
+ subtractUpper = lattice_1.Top;
230
201
  }
231
202
  else if (otherUpper === lattice_1.Top) {
232
- subUpper = thisUpper.difference(otherLower);
203
+ subtractUpper = thisUpper.difference(otherLower);
233
204
  }
234
205
  else {
235
- subUpper = thisUpper.difference(otherUpper);
206
+ subtractUpper = thisUpper.difference(otherUpper);
236
207
  }
237
- return this.create({ min: subLower, range: subUpper === lattice_1.Top ? lattice_1.Top : subUpper.difference(subLower) });
208
+ return this.create({
209
+ must: subtractLower,
210
+ may: subtractUpper === lattice_1.Top ? lattice_1.Top : subtractUpper.difference(subtractLower)
211
+ });
238
212
  }
239
- widen(other) {
213
+ widenValue(other) {
240
214
  const thisLower = this.lower(), thisUpper = this.upper();
241
215
  const otherLower = other.lower(), otherUpper = other.upper();
242
- if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom) {
243
- return this.create(other.value);
244
- }
245
- else if (otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
246
- return this.create(this.value);
247
- }
248
216
  let widenLower;
249
- if (!thisLower.isSubsetOf(otherLower)) {
250
- widenLower = new Set();
217
+ if (thisLower.isSubsetOf(otherLower)) {
218
+ widenLower = thisLower;
251
219
  }
252
220
  else {
253
- widenLower = thisLower;
221
+ widenLower = new Set();
254
222
  }
255
223
  let widenUpper;
256
- if (thisUpper === lattice_1.Top || otherUpper === lattice_1.Top || !otherUpper.isSubsetOf(thisUpper)) {
257
- widenUpper = lattice_1.Top;
224
+ if (thisUpper !== lattice_1.Top && otherUpper !== lattice_1.Top && otherUpper.isSubsetOf(thisUpper)) {
225
+ widenUpper = thisUpper;
258
226
  }
259
227
  else {
260
- widenUpper = thisUpper;
228
+ widenUpper = lattice_1.Top;
261
229
  }
262
- return this.create({ min: widenLower, range: widenUpper === lattice_1.Top ? lattice_1.Top : widenUpper.difference(widenLower) });
230
+ return this.create({
231
+ must: widenLower,
232
+ may: widenUpper === lattice_1.Top ? lattice_1.Top : widenUpper.difference(widenLower)
233
+ });
263
234
  }
264
- narrow(other) {
235
+ narrowValue(other) {
265
236
  const thisLower = this.lower(), thisUpper = this.upper();
266
237
  const otherLower = other.lower(), otherUpper = other.upper();
267
- if (thisLower === lattice_1.Bottom || thisUpper === lattice_1.Bottom || otherLower === lattice_1.Bottom || otherUpper === lattice_1.Bottom) {
268
- return this.bottom();
269
- }
270
- let meetUpper;
271
- if (thisUpper === lattice_1.Top) {
272
- meetUpper = otherUpper;
273
- }
274
- else if (otherUpper === lattice_1.Top) {
275
- meetUpper = thisUpper;
276
- }
277
- else {
278
- meetUpper = thisUpper.intersection(otherUpper);
279
- }
280
- if (meetUpper !== lattice_1.Top && !thisLower.union(otherLower).isSubsetOf(meetUpper)) {
238
+ if (this.meetValue(other).isBottom()) {
281
239
  return this.bottom();
282
240
  }
283
241
  let narrowLower;
@@ -294,103 +252,83 @@ class SetRangeDomain extends abstract_domain_1.AbstractDomain {
294
252
  else {
295
253
  narrowUpper = thisUpper;
296
254
  }
297
- return this.create({ min: narrowLower, range: narrowUpper === lattice_1.Top ? lattice_1.Top : narrowUpper.difference(narrowLower) });
298
- }
299
- concretize(limit) {
300
- if (this.value === lattice_1.Bottom) {
301
- return new Set();
302
- }
303
- else if (this.value.range === lattice_1.Top || 2 ** (this.value.range.size) > limit) {
304
- return lattice_1.Top;
305
- }
306
- const subsets = [new this.setType()];
307
- for (const element of this.value.range) {
308
- const newSubsets = subsets.map(subset => new this.setType([...subset, element]));
309
- for (const subset of newSubsets) {
310
- subsets.push(subset);
311
- }
312
- }
313
- return new Set(subsets.map(subset => this.value === lattice_1.Bottom ? subset : this.value.min.union(subset)));
314
- }
315
- abstract(concrete) {
316
- return SetRangeDomain.abstract(concrete, this.limit);
255
+ return this.create({
256
+ must: narrowLower,
257
+ may: narrowUpper === lattice_1.Top ? lattice_1.Top : narrowUpper.difference(narrowLower)
258
+ });
317
259
  }
318
- satisfies(set, comparator = satisfiable_domain_1.SetComparator.Equal) {
260
+ satisfies(set, comparator = value_abstract_domain_1.SetComparator.Equal) {
319
261
  const lower = this.lower(), upper = this.upper();
320
262
  if (lower === lattice_1.Bottom || upper === lattice_1.Bottom) {
321
263
  return logic_1.Ternary.Never;
322
264
  }
323
265
  const value = new this.setType(set);
324
266
  switch (comparator) {
325
- case satisfiable_domain_1.SetComparator.Equal: {
267
+ case value_abstract_domain_1.SetComparator.Equal: {
326
268
  if (lower.isSubsetOf(value) && (upper === lattice_1.Top || value.isSubsetOf(upper))) {
327
269
  return upper !== lattice_1.Top && lower.size === upper.size ? logic_1.Ternary.Always : logic_1.Ternary.Maybe;
328
270
  }
329
271
  return logic_1.Ternary.Never;
330
272
  }
331
- case satisfiable_domain_1.SetComparator.SubsetOrEqual: {
273
+ case value_abstract_domain_1.SetComparator.SubsetOrEqual: {
332
274
  if (upper === lattice_1.Top || value.isSubsetOf(upper)) {
333
275
  return value.isSubsetOf(lower) ? logic_1.Ternary.Always : logic_1.Ternary.Maybe;
334
276
  }
335
277
  return logic_1.Ternary.Never;
336
278
  }
337
- case satisfiable_domain_1.SetComparator.Subset: {
279
+ case value_abstract_domain_1.SetComparator.Subset: {
338
280
  if (upper === lattice_1.Top || (value.isSubsetOf(upper) && !(0, set_1.setEquals)(value, upper))) {
339
281
  return value.isSubsetOf(lower) && !(0, set_1.setEquals)(value, lower) ? logic_1.Ternary.Always : logic_1.Ternary.Maybe;
340
282
  }
341
283
  return logic_1.Ternary.Never;
342
284
  }
285
+ case value_abstract_domain_1.SetComparator.Intersect: {
286
+ if (this.isInfinite() || (this.isFinite() && [...set].some(value => this.may.has(value)))) {
287
+ return (this.isValue() && [...set].some(value => this.must.has(value))) ? logic_1.Ternary.Always : logic_1.Ternary.Maybe;
288
+ }
289
+ return logic_1.Ternary.Never;
290
+ }
291
+ case value_abstract_domain_1.SetComparator.NoIntersect: {
292
+ return logic_1.TernaryLogic.negate(this.satisfies(set, value_abstract_domain_1.SetComparator.Intersect));
293
+ }
343
294
  default: {
344
295
  (0, assert_1.assertUnreachable)(comparator);
345
296
  }
346
297
  }
347
298
  }
348
299
  /**
349
- * Extends the minimum set of the current abstract value down to the empty set.
300
+ * Extends the must set of the current abstract value down to the empty set.
350
301
  */
351
302
  widenDown() {
352
- const upper = this.upper();
353
- if (upper === lattice_1.Bottom) {
354
- return this.bottom();
355
- }
356
- else {
357
- return this.create({ min: new this.setType(), range: upper });
303
+ if (this.isValue()) {
304
+ return this.create({ must: new this.setType(), may: this.upper() });
358
305
  }
306
+ return this.bottom();
359
307
  }
360
308
  /**
361
- * Extends the maximum set of the current abstract value up to {@link Top}.
309
+ * Extends the may set of the current abstract value up to {@link Top}.
362
310
  */
363
311
  widenUp() {
364
- const lower = this.lower();
365
- if (lower === lattice_1.Bottom) {
366
- return this.bottom();
367
- }
368
- else {
369
- return this.create({ min: lower, range: lattice_1.Top });
312
+ if (this.isValue()) {
313
+ return this.create({ must: this.must, may: lattice_1.Top });
370
314
  }
315
+ return this.bottom();
371
316
  }
372
- toJSON() {
373
- if (this.value === lattice_1.Bottom) {
374
- return this.value.description;
375
- }
376
- const min = this.value.min.values().toArray();
377
- const range = this.value.range === lattice_1.Top ? this.value.range.description : this.value.range.values().toArray();
378
- return { min, range };
317
+ jsonify() {
318
+ const must = this.must.values().toArray();
319
+ const may = this.may === lattice_1.Top ? lattice_1.Top.description : this.may.values().toArray();
320
+ return { must, may };
379
321
  }
380
- toString() {
381
- if (this.value === lattice_1.Bottom) {
382
- return lattice_1.BottomSymbol;
322
+ stringify() {
323
+ const must = this.must.values().map(abstract_domain_1.AbstractDomain.toString).toArray().join(', ');
324
+ if (this.may === lattice_1.Top) {
325
+ return `[{${must}}, ${lattice_1.TopSymbol}]`;
383
326
  }
384
- else if (this.value.range === lattice_1.Top) {
385
- const minString = this.value.min.values().map(abstract_domain_1.AbstractDomain.toString).toArray().join(', ');
386
- return `[{${minString}}, ${lattice_1.TopSymbol}]`;
387
- }
388
- const minString = this.value.min.values().map(abstract_domain_1.AbstractDomain.toString).toArray().join(', ');
389
- const rangeString = this.value.range.values().map(abstract_domain_1.AbstractDomain.toString).toArray().join(', ');
390
- return `[{${minString}}, {${rangeString}}]`;
327
+ const may = this.may.values().map(abstract_domain_1.AbstractDomain.toString).toArray().join(', ');
328
+ return `[{${must}}, {${may}}]`;
391
329
  }
392
330
  isTop() {
393
- return this.value !== lattice_1.Bottom && this.value.min.size === 0 && this.value.range === lattice_1.Top;
331
+ return this.isValue() && this.must.size === 0 && this.may === lattice_1.Top;
394
332
  }
395
333
  isBottom() {
396
334
  return this.value === lattice_1.Bottom;
@@ -399,7 +337,10 @@ class SetRangeDomain extends abstract_domain_1.AbstractDomain {
399
337
  return this.value !== lattice_1.Bottom;
400
338
  }
401
339
  isFinite() {
402
- return this.value !== lattice_1.Bottom && this.value.range !== lattice_1.Top;
340
+ return this.isValue() && this.may !== lattice_1.Top;
341
+ }
342
+ isInfinite() {
343
+ return this.isValue() && this.may === lattice_1.Top;
403
344
  }
404
345
  }
405
346
  exports.SetRangeDomain = SetRangeDomain;
@@ -1,7 +1,7 @@
1
1
  import { Ternary } from '../../util/logic';
2
2
  import { AbstractDomain } from './abstract-domain';
3
3
  import { Bottom, Top } from './lattice';
4
- import { type SatisfiableDomain, SetComparator } from './satisfiable-domain';
4
+ import { type SetDomain, SetComparator } from './value-abstract-domain';
5
5
  /** The type of the actual values of the set upper bound domain as set */
6
6
  type SetUpperBoundValue<T> = ReadonlySet<T>;
7
7
  /** The type of the Top element of the set upper bound domain as {@link Top} symbol */
@@ -16,39 +16,33 @@ type SetUpperBoundLift<T> = SetUpperBoundValue<T> | SetUpperBoundTop | SetUpperB
16
16
  * @template T - Type of the values in the abstract domain
17
17
  * @template Value - Type of the constraint in the abstract domain (Top, Bottom, or an actual value)
18
18
  */
19
- export declare class SetUpperBoundDomain<T, Value extends SetUpperBoundLift<T> = SetUpperBoundLift<T>> extends AbstractDomain<ReadonlySet<T>, SetUpperBoundValue<T>, SetUpperBoundTop, SetUpperBoundBottom, Value> implements SatisfiableDomain<ReadonlySet<T>> {
19
+ export declare class SetUpperBoundDomain<T, Value extends SetUpperBoundLift<T> = SetUpperBoundLift<T>> extends AbstractDomain<SetUpperBoundValue<T>, SetUpperBoundTop, SetUpperBoundBottom, Value> implements SetDomain<T> {
20
20
  readonly limit: number;
21
- private readonly setType;
21
+ protected readonly setType: typeof Set<T>;
22
22
  /**
23
23
  * @param limit - A limit for the maximum number of elements to store in the set
24
24
  * @param newSet - An optional set constructor for the domain elements if the type `T` is not storable in a HashSet
25
25
  */
26
26
  constructor(value: Value | T[], limit?: number, setType?: typeof Set<T>);
27
27
  create(value: SetUpperBoundLift<T> | T[]): this;
28
+ from(...values: ReadonlySet<T>[] | T[][]): this;
28
29
  static top<T>(limit?: number, setType?: typeof Set<T>): SetUpperBoundDomain<T, SetUpperBoundTop>;
29
30
  static bottom<T>(limit?: number, setType?: typeof Set<T>): SetUpperBoundDomain<T, SetUpperBoundBottom>;
30
- static abstract<T>(concrete: ReadonlySet<ReadonlySet<T>> | typeof Top, limit?: number, setType?: typeof Set<T>): SetUpperBoundDomain<T>;
31
+ static from<T>(values: Set<T> | T[] | Set<T>[] | T[][], limit?: number, setType?: typeof Set<T>): SetUpperBoundDomain<T>;
31
32
  top(): this & SetUpperBoundDomain<T, SetUpperBoundTop>;
32
33
  bottom(): this & SetUpperBoundDomain<T, SetUpperBoundBottom>;
33
- equals(other: this): boolean;
34
- leq(other: this): boolean;
35
- join(other: SetUpperBoundLift<T> | T[]): this;
36
- join(other: this): this;
37
- meet(other: SetUpperBoundLift<T> | T[]): this;
38
- meet(other: this): this;
39
- /**
40
- * Subtracts another abstract value from the current abstract value by removing all elements of the other abstract value from the current abstract value.
41
- */
42
- subtract(other: this | SetUpperBoundLift<T> | T[]): this;
43
- widen(other: this): this;
44
- narrow(other: this): this;
45
- concretize(limit: number): ReadonlySet<ReadonlySet<T>> | typeof Top;
46
- abstract(concrete: ReadonlySet<ReadonlySet<T>> | typeof Top): this;
34
+ protected equalsValue(this: SetUpperBoundDomain<T, SetUpperBoundValue<T>>, other: SetUpperBoundDomain<T, SetUpperBoundValue<T>>): boolean;
35
+ protected leqValue(this: SetUpperBoundDomain<T, SetUpperBoundValue<T>>, other: SetUpperBoundDomain<T, SetUpperBoundValue<T>>): boolean;
36
+ protected joinValue(this: this & SetUpperBoundDomain<T, SetUpperBoundValue<T>>, other: SetUpperBoundDomain<T, SetUpperBoundValue<T>>): this;
37
+ protected meetValue(this: this & SetUpperBoundDomain<T, SetUpperBoundValue<T>>, other: SetUpperBoundDomain<T, SetUpperBoundValue<T>>): this;
38
+ union(other: this | SetUpperBoundLift<T> | T[]): this;
39
+ intersect(other: this | SetUpperBoundLift<T> | T[]): this;
40
+ subtract(other: this | SetUpperBoundLift<T>): this;
47
41
  satisfies(set: ReadonlySet<T> | T[], comparator?: SetComparator): Ternary;
48
- toJSON(): unknown;
49
- toString(): string;
50
- isTop(): this is SetUpperBoundDomain<T, SetUpperBoundTop>;
51
- isBottom(): this is SetUpperBoundDomain<T, SetUpperBoundBottom>;
52
- isValue(): this is SetUpperBoundDomain<T, SetUpperBoundValue<T>>;
42
+ protected jsonify(this: SetUpperBoundDomain<T, SetUpperBoundValue<T>>): unknown;
43
+ protected stringify(this: SetUpperBoundDomain<T, SetUpperBoundValue<T>>): string;
44
+ isTop(): this is this & SetUpperBoundDomain<T, SetUpperBoundTop>;
45
+ isBottom(): this is this & SetUpperBoundDomain<T, SetUpperBoundBottom>;
46
+ isValue(): this is this & SetUpperBoundDomain<T, SetUpperBoundValue<T>>;
53
47
  }
54
48
  export {};