@eagleoutice/flowr 2.2.11 → 2.2.13

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 (301) hide show
  1. package/README.md +82 -20
  2. package/benchmark/slicer.d.ts +49 -22
  3. package/benchmark/slicer.js +89 -29
  4. package/benchmark/stats/print.js +16 -10
  5. package/benchmark/stats/size-of.js +18 -1
  6. package/benchmark/stats/stats.d.ts +3 -0
  7. package/benchmark/summarizer/first-phase/input.js +1 -1
  8. package/benchmark/summarizer/first-phase/process.js +3 -3
  9. package/benchmark/summarizer/second-phase/process.js +9 -3
  10. package/benchmark/summarizer/summarizer.js +1 -1
  11. package/cli/benchmark-app.d.ts +5 -0
  12. package/cli/benchmark-app.js +49 -6
  13. package/cli/benchmark-helper-app.d.ts +4 -0
  14. package/cli/benchmark-helper-app.js +20 -4
  15. package/cli/common/options.js +15 -6
  16. package/cli/common/script.js +1 -1
  17. package/cli/flowr.js +1 -1
  18. package/cli/repl/commands/repl-cfg.d.ts +2 -0
  19. package/cli/repl/commands/repl-cfg.js +38 -24
  20. package/cli/repl/commands/repl-commands.js +6 -2
  21. package/cli/repl/commands/repl-dataflow.d.ts +2 -0
  22. package/cli/repl/commands/repl-dataflow.js +37 -3
  23. package/cli/repl/commands/repl-execute.js +1 -1
  24. package/cli/repl/commands/repl-main.d.ts +1 -1
  25. package/cli/repl/commands/repl-main.js +1 -1
  26. package/cli/repl/commands/repl-normalize.js +1 -1
  27. package/cli/repl/commands/repl-query.js +2 -2
  28. package/cli/repl/core.js +1 -1
  29. package/cli/repl/prompt.js +1 -1
  30. package/cli/repl/server/connection.js +4 -4
  31. package/cli/repl/server/messages/message-analysis.d.ts +1 -1
  32. package/cli/script-core/statistics-core.js +1 -1
  33. package/cli/script-core/statistics-helper-core.js +4 -4
  34. package/config.d.ts +60 -21
  35. package/config.js +24 -4
  36. package/control-flow/basic-cfg-guided-visitor.d.ts +39 -0
  37. package/control-flow/basic-cfg-guided-visitor.js +114 -0
  38. package/control-flow/cfg-properties.d.ts +26 -0
  39. package/control-flow/cfg-properties.js +100 -0
  40. package/control-flow/cfg-simplification.d.ts +18 -0
  41. package/control-flow/cfg-simplification.js +55 -0
  42. package/control-flow/cfg-to-basic-blocks.d.ts +5 -0
  43. package/control-flow/cfg-to-basic-blocks.js +81 -0
  44. package/control-flow/control-flow-graph.d.ts +247 -0
  45. package/control-flow/control-flow-graph.js +290 -0
  46. package/control-flow/dfg-cfg-guided-visitor.d.ts +32 -0
  47. package/control-flow/dfg-cfg-guided-visitor.js +71 -0
  48. package/control-flow/diff-cfg.d.ts +11 -0
  49. package/control-flow/diff-cfg.js +161 -0
  50. package/control-flow/extract-cfg.d.ts +30 -0
  51. package/control-flow/extract-cfg.js +475 -0
  52. package/control-flow/happens-before.d.ts +7 -0
  53. package/{util/cfg → control-flow}/happens-before.js +3 -3
  54. package/control-flow/semantic-cfg-guided-visitor.d.ts +452 -0
  55. package/control-flow/semantic-cfg-guided-visitor.js +492 -0
  56. package/control-flow/simple-visitor.d.ts +25 -0
  57. package/control-flow/simple-visitor.js +80 -0
  58. package/control-flow/syntax-cfg-guided-visitor.d.ts +128 -0
  59. package/control-flow/syntax-cfg-guided-visitor.js +166 -0
  60. package/core/print/print.d.ts +1 -1
  61. package/core/print/slice-diff-ansi.js +1 -1
  62. package/core/steps/pipeline/create-pipeline.js +1 -1
  63. package/dataflow/environments/built-in-config.d.ts +5 -2
  64. package/dataflow/environments/built-in-config.js +17 -8
  65. package/dataflow/environments/built-in.d.ts +16 -5
  66. package/dataflow/environments/built-in.js +55 -6
  67. package/dataflow/environments/clone.d.ts +5 -0
  68. package/dataflow/environments/clone.js +5 -0
  69. package/dataflow/environments/default-builtin-config.d.ts +2 -0
  70. package/dataflow/environments/default-builtin-config.js +164 -13
  71. package/dataflow/environments/define.d.ts +5 -1
  72. package/dataflow/environments/define.js +36 -10
  73. package/dataflow/environments/overwrite.js +4 -0
  74. package/dataflow/environments/remove.d.ts +6 -0
  75. package/dataflow/environments/remove.js +24 -0
  76. package/dataflow/environments/resolve-by-name.js +16 -5
  77. package/dataflow/extractor.js +2 -2
  78. package/dataflow/graph/dataflowgraph-builder.d.ts +79 -7
  79. package/dataflow/graph/dataflowgraph-builder.js +106 -8
  80. package/dataflow/graph/diff-dataflow-graph.d.ts +16 -0
  81. package/dataflow/graph/{diff.js → diff-dataflow-graph.js} +30 -56
  82. package/dataflow/graph/graph.d.ts +17 -4
  83. package/dataflow/graph/graph.js +51 -12
  84. package/dataflow/graph/vertex.d.ts +59 -4
  85. package/dataflow/graph/vertex.js +32 -0
  86. package/dataflow/internal/linker.d.ts +3 -2
  87. package/dataflow/internal/linker.js +36 -25
  88. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +1 -1
  89. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +1 -1
  90. package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -0
  91. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +67 -54
  92. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +6 -4
  93. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +108 -21
  94. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +54 -17
  95. package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +10 -0
  96. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +140 -0
  97. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +9 -4
  98. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +3 -2
  99. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +15 -4
  100. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +4 -3
  101. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -3
  102. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +4 -3
  103. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +51 -17
  104. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +1 -1
  105. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -7
  106. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +3 -2
  107. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +4 -0
  108. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +100 -31
  109. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +7 -0
  110. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +41 -0
  111. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +35 -8
  112. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +4 -3
  113. package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +15 -0
  114. package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +75 -0
  115. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +3 -3
  116. package/dataflow/internal/process/functions/call/common.d.ts +5 -2
  117. package/dataflow/internal/process/functions/call/common.js +9 -5
  118. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -2
  119. package/dataflow/internal/process/functions/call/known-call-handling.js +2 -1
  120. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +2 -0
  121. package/dataflow/internal/process/functions/call/named-call-handling.js +10 -6
  122. package/dataflow/internal/process/functions/call/unnamed-call-handling.d.ts +1 -0
  123. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +6 -4
  124. package/dataflow/internal/process/process-named-call.d.ts +4 -1
  125. package/dataflow/internal/process/process-named-call.js +8 -5
  126. package/dataflow/origin/dfg-get-origin.d.ts +82 -0
  127. package/dataflow/origin/dfg-get-origin.js +116 -0
  128. package/documentation/doc-util/doc-cfg.d.ts +20 -4
  129. package/documentation/doc-util/doc-cfg.js +41 -7
  130. package/documentation/doc-util/doc-cli-option.js +4 -2
  131. package/documentation/doc-util/doc-code.js +10 -2
  132. package/documentation/doc-util/doc-dfg.js +3 -3
  133. package/documentation/doc-util/doc-escape.d.ts +7 -0
  134. package/documentation/doc-util/doc-escape.js +19 -0
  135. package/documentation/doc-util/doc-files.d.ts +1 -0
  136. package/documentation/doc-util/doc-files.js +2 -1
  137. package/documentation/doc-util/doc-normalized-ast.js +3 -3
  138. package/documentation/doc-util/doc-query.js +2 -2
  139. package/documentation/doc-util/doc-repl.js +1 -1
  140. package/documentation/doc-util/doc-search.js +1 -1
  141. package/documentation/doc-util/doc-server-message.js +2 -2
  142. package/documentation/doc-util/doc-structure.d.ts +1 -0
  143. package/documentation/doc-util/doc-structure.js +5 -0
  144. package/documentation/doc-util/doc-types.d.ts +7 -1
  145. package/documentation/doc-util/doc-types.js +13 -2
  146. package/documentation/print-capabilities-markdown.js +28 -2
  147. package/documentation/print-cfg-wiki.d.ts +1 -0
  148. package/documentation/print-cfg-wiki.js +572 -0
  149. package/documentation/print-core-wiki.js +2 -2
  150. package/documentation/print-dataflow-graph-wiki.js +180 -25
  151. package/documentation/print-engines-wiki.js +1 -1
  152. package/documentation/print-faq-wiki.d.ts +1 -0
  153. package/documentation/print-faq-wiki.js +75 -0
  154. package/documentation/print-interface-wiki.js +2 -1
  155. package/documentation/print-linting-and-testing-wiki.js +52 -36
  156. package/documentation/print-normalized-ast-wiki.js +1 -1
  157. package/documentation/print-onboarding-wiki.d.ts +1 -0
  158. package/documentation/print-onboarding-wiki.js +42 -0
  159. package/documentation/print-query-wiki.js +23 -3
  160. package/documentation/print-readme.js +10 -3
  161. package/package.json +10 -6
  162. package/queries/catalog/call-context-query/call-context-query-executor.js +5 -5
  163. package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
  164. package/queries/catalog/call-context-query/call-context-query-format.js +2 -2
  165. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +2 -2
  166. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +24 -21
  167. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
  168. package/queries/catalog/cluster-query/cluster-query-format.js +1 -1
  169. package/queries/catalog/config-query/config-query-format.d.ts +1 -1
  170. package/queries/catalog/config-query/config-query-format.js +2 -2
  171. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
  172. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -2
  173. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
  174. package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -2
  175. package/queries/catalog/dependencies-query/dependencies-query-executor.js +17 -7
  176. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +2 -26
  177. package/queries/catalog/dependencies-query/dependencies-query-format.js +4 -147
  178. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +24 -0
  179. package/queries/catalog/dependencies-query/function-info/function-info.js +10 -0
  180. package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +2 -0
  181. package/queries/catalog/dependencies-query/function-info/library-functions.js +18 -0
  182. package/queries/catalog/dependencies-query/function-info/read-functions.d.ts +2 -0
  183. package/queries/catalog/dependencies-query/function-info/read-functions.js +101 -0
  184. package/queries/catalog/dependencies-query/function-info/source-functions.d.ts +2 -0
  185. package/queries/catalog/dependencies-query/function-info/source-functions.js +11 -0
  186. package/queries/catalog/dependencies-query/function-info/write-functions.d.ts +2 -0
  187. package/queries/catalog/dependencies-query/function-info/write-functions.js +87 -0
  188. package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
  189. package/queries/catalog/happens-before-query/happens-before-query-executor.js +4 -4
  190. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
  191. package/queries/catalog/happens-before-query/happens-before-query-format.js +2 -2
  192. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
  193. package/queries/catalog/id-map-query/id-map-query-format.js +2 -2
  194. package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -1
  195. package/queries/catalog/lineage-query/lineage-query-format.js +2 -2
  196. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
  197. package/queries/catalog/location-map-query/location-map-query-format.js +2 -2
  198. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
  199. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +2 -2
  200. package/queries/catalog/origin-query/origin-query-executor.d.ts +5 -0
  201. package/queries/catalog/origin-query/origin-query-executor.js +33 -0
  202. package/queries/catalog/origin-query/origin-query-format.d.ts +71 -0
  203. package/queries/catalog/origin-query/origin-query-format.js +27 -0
  204. package/queries/catalog/project-query/project-query-format.d.ts +1 -1
  205. package/queries/catalog/project-query/project-query-format.js +2 -2
  206. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
  207. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -2
  208. package/queries/catalog/search-query/search-query-format.d.ts +1 -1
  209. package/queries/catalog/search-query/search-query-format.js +2 -2
  210. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
  211. package/queries/catalog/static-slice-query/static-slice-query-format.js +2 -2
  212. package/queries/query-print.d.ts +1 -1
  213. package/queries/query-print.js +4 -4
  214. package/queries/query.d.ts +61 -2
  215. package/queries/query.js +3 -1
  216. package/r-bridge/data/data.d.ts +2 -2
  217. package/r-bridge/data/data.js +2 -2
  218. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -2
  219. package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +5 -0
  220. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -2
  221. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +5 -0
  222. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +1 -1
  223. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +1 -1
  224. package/r-bridge/lang-4.x/ast/model/processing/fold.js +3 -1
  225. package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +1 -1
  226. package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +1 -1
  227. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +1 -1
  228. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
  229. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
  230. package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +1 -1
  231. package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +1 -1
  232. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +1 -1
  233. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -1
  234. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -2
  235. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +4 -4
  236. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +26 -8
  237. package/r-bridge/retriever.js +1 -1
  238. package/search/search-executor/search-generators.d.ts +1 -1
  239. package/search/search-executor/search-transformer.d.ts +1 -1
  240. package/slicing/criterion/collect-all.js +1 -1
  241. package/slicing/static/slice-call.js +13 -3
  242. package/statistics/features/supported/assignments/post-process.js +1 -1
  243. package/statistics/features/supported/defined-functions/post-process.js +2 -2
  244. package/statistics/features/supported/used-functions/post-process.js +1 -1
  245. package/statistics/features/supported/used-packages/post-process.js +2 -2
  246. package/statistics/features/supported/values/post-process.js +2 -2
  247. package/statistics/output/print-stats.js +2 -2
  248. package/statistics/summarizer/post-process/clusterer.d.ts +1 -1
  249. package/statistics/summarizer/post-process/clusterer.js +1 -1
  250. package/statistics/summarizer/post-process/histogram.js +3 -3
  251. package/statistics/summarizer/post-process/post-process-output.js +3 -3
  252. package/statistics/summarizer/second-phase/process.js +2 -2
  253. package/statistics/summarizer/summarizer.js +2 -2
  254. package/util/assert.js +36 -1
  255. package/util/cfg/cfg.d.ts +0 -80
  256. package/util/cfg/cfg.js +0 -549
  257. package/util/{arrays.d.ts → collections/arrays.d.ts} +24 -1
  258. package/util/{arrays.js → collections/arrays.js} +44 -3
  259. package/util/collections/set.js +17 -0
  260. package/util/{list-access.d.ts → containers.d.ts} +24 -4
  261. package/util/{list-access.js → containers.js} +42 -12
  262. package/util/diff-graph.d.ts +47 -0
  263. package/util/diff-graph.js +61 -0
  264. package/util/diff.d.ts +6 -6
  265. package/util/diff.js +1 -1
  266. package/util/mermaid/ast.js +12 -1
  267. package/util/mermaid/cfg.d.ts +9 -2
  268. package/util/mermaid/cfg.js +65 -13
  269. package/util/mermaid/dfg.d.ts +2 -1
  270. package/util/mermaid/dfg.js +26 -10
  271. package/util/mermaid/mermaid.d.ts +2 -0
  272. package/util/mermaid/mermaid.js +6 -0
  273. package/util/parallel.d.ts +2 -1
  274. package/util/parallel.js +11 -2
  275. package/util/prefix.d.ts +13 -0
  276. package/util/prefix.js +34 -0
  277. package/util/quads.js +1 -1
  278. package/util/schema.d.ts +1 -1
  279. package/util/schema.js +1 -1
  280. package/util/summarizer.js +1 -1
  281. package/util/{text.js → text/text.js} +1 -1
  282. package/util/{time.js → text/time.js} +1 -1
  283. package/util/version.js +1 -1
  284. package/dataflow/graph/diff.d.ts +0 -36
  285. package/util/cfg/happens-before.d.ts +0 -7
  286. package/util/cfg/visitor.d.ts +0 -9
  287. package/util/cfg/visitor.js +0 -30
  288. package/util/set.js +0 -31
  289. /package/util/{bimap.d.ts → collections/bimap.d.ts} +0 -0
  290. /package/util/{bimap.js → collections/bimap.js} +0 -0
  291. /package/util/{defaultmap.d.ts → collections/defaultmap.d.ts} +0 -0
  292. /package/util/{defaultmap.js → collections/defaultmap.js} +0 -0
  293. /package/util/{set.d.ts → collections/set.d.ts} +0 -0
  294. /package/util/{ansi.d.ts → text/ansi.d.ts} +0 -0
  295. /package/util/{ansi.js → text/ansi.js} +0 -0
  296. /package/util/{args.d.ts → text/args.d.ts} +0 -0
  297. /package/util/{args.js → text/args.js} +0 -0
  298. /package/util/{strings.d.ts → text/strings.d.ts} +0 -0
  299. /package/util/{strings.js → text/strings.js} +0 -0
  300. /package/util/{text.d.ts → text/text.d.ts} +0 -0
  301. /package/util/{time.d.ts → text/time.d.ts} +0 -0
package/util/parallel.js CHANGED
@@ -56,16 +56,18 @@ class LimitedThreadPool {
56
56
  skipped = [];
57
57
  currentlyRunning = new Set();
58
58
  reportingInterval = undefined;
59
+ timeLimitInMs;
59
60
  /**
60
61
  * Create a new parallel helper that runs the given `module` once for each list of {@link Arguments} in the `queue`.
61
62
  * The `limit` stops the execution if `<limit>` number of runs exited successfully.
62
63
  * The `parallel` parameter limits the number of parallel executions.
63
64
  */
64
- constructor(module, queue, limit, parallel) {
65
+ constructor(module, queue, limit, parallel, timeLimitInMs) {
65
66
  this.workingQueue = queue;
66
67
  this.limit = limit;
67
68
  this.module = module;
68
69
  this.parallel = parallel;
70
+ this.timeLimitInMs = timeLimitInMs;
69
71
  }
70
72
  async run() {
71
73
  this.reportingInterval = setInterval(() => {
@@ -93,8 +95,15 @@ class LimitedThreadPool {
93
95
  console.log(`[${this.counter}/${this.limit}] Running next, currently running: ${this.currentlyRunning.size}, queue: ${this.workingQueue.length} [args: ${args.join(' ')}]`);
94
96
  const child = cp.fork(this.module, args);
95
97
  child.on('exit', this.onChildExit(args));
98
+ let timeout;
99
+ if (this.timeLimitInMs) {
100
+ timeout = setTimeout(() => {
101
+ log_1.log.error(`Killing child process with '${JSON.stringify(args)}' after ${this.timeLimitInMs}ms`);
102
+ child.kill();
103
+ }, this.timeLimitInMs);
104
+ }
96
105
  // schedule re-schedule
97
- await new Promise(resolve => child.on('exit', resolve)).then(() => this.runNext());
106
+ await new Promise(resolve => child.on('exit', resolve)).then(() => clearTimeout(timeout)).then(() => this.runNext());
98
107
  }
99
108
  onChildExit(args) {
100
109
  return (code, signal) => {
@@ -0,0 +1,13 @@
1
+ /**
2
+ * given a potentially partial prefix like `hell`, this finds the matching name in the map, but only
3
+ * if it is unique!
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * findByPrefixIfUnique('hell', { 'hello', 'bar' }) // => 'hello'
8
+ * findByPrefixIfUnique('hell', { 'hello', 'hell' }) // => 'hell' (full match)
9
+ * findByPrefixIfUnique('h', { 'hello', 'hell' }) // => undefined (not unique)
10
+ * findByPrefixIfUnique('', { 'hello', 'hell' }) // => undefined (empty prefix)
11
+ * ```
12
+ */
13
+ export declare function findByPrefixIfUnique(prefix: string, keys: readonly string[]): string | undefined;
package/util/prefix.js ADDED
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findByPrefixIfUnique = findByPrefixIfUnique;
4
+ /**
5
+ * given a potentially partial prefix like `hell`, this finds the matching name in the map, but only
6
+ * if it is unique!
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * findByPrefixIfUnique('hell', { 'hello', 'bar' }) // => 'hello'
11
+ * findByPrefixIfUnique('hell', { 'hello', 'hell' }) // => 'hell' (full match)
12
+ * findByPrefixIfUnique('h', { 'hello', 'hell' }) // => undefined (not unique)
13
+ * findByPrefixIfUnique('', { 'hello', 'hell' }) // => undefined (empty prefix)
14
+ * ```
15
+ */
16
+ function findByPrefixIfUnique(prefix, keys) {
17
+ if (prefix === '') {
18
+ return undefined;
19
+ }
20
+ let found = undefined;
21
+ for (const key of keys) {
22
+ if (key === prefix) {
23
+ return key;
24
+ }
25
+ if (key.startsWith(prefix)) {
26
+ if (found) {
27
+ return undefined;
28
+ }
29
+ found = key;
30
+ }
31
+ }
32
+ return found;
33
+ }
34
+ //# sourceMappingURL=prefix.js.map
package/util/quads.js CHANGED
@@ -19,7 +19,7 @@ const namedNode = (v) => n3_1.DataFactory.namedNode(v);
19
19
  const quad = (s, p, o, g) => n3_1.DataFactory.quad(s, p, o, g);
20
20
  const objects_1 = require("./objects");
21
21
  const assert_1 = require("./assert");
22
- const defaultmap_1 = require("./defaultmap");
22
+ const defaultmap_1 = require("./collections/defaultmap");
23
23
  const literal = (v, n) => n3_1.DataFactory.literal(v, n);
24
24
  const log_1 = require("./log");
25
25
  const domain = 'https://uni-ulm.de/r-ast/';
package/util/schema.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type Joi from 'joi';
2
- import type { OutputFormatter } from './ansi';
2
+ import type { OutputFormatter } from './text/ansi';
3
3
  interface SchemaLine {
4
4
  level: number;
5
5
  text: string;
package/util/schema.js CHANGED
@@ -4,7 +4,7 @@ exports.describeSchema = describeSchema;
4
4
  exports.genericDescription = genericDescription;
5
5
  exports.headerLine = headerLine;
6
6
  exports.describeObject = describeObject;
7
- const ansi_1 = require("./ansi");
7
+ const ansi_1 = require("./text/ansi");
8
8
  function describeSchema(schema, f = ansi_1.formatter) {
9
9
  const description = schema.describe();
10
10
  const lines = genericDescription(1, f, f.format('.', { effect: ansi_1.ColorEffect.Foreground, color: 7 /* Colors.White */ }), description);
@@ -4,7 +4,7 @@ exports.Summarizer = void 0;
4
4
  exports.summarizedMeasurement2Csv = summarizedMeasurement2Csv;
5
5
  exports.summarizedMeasurement2CsvHeader = summarizedMeasurement2CsvHeader;
6
6
  exports.summarizeMeasurement = summarizeMeasurement;
7
- const arrays_1 = require("./arrays");
7
+ const arrays_1 = require("./collections/arrays");
8
8
  class Summarizer {
9
9
  config;
10
10
  log;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nth = nth;
4
- const assert_1 = require("./assert");
4
+ const assert_1 = require("../assert");
5
5
  function nth(n) {
6
6
  (0, assert_1.guard)(isFinite(n) && n >= 1, 'n must be a non-negative number');
7
7
  const num = String(n);
@@ -13,7 +13,7 @@ function date2string(date = new Date()) {
13
13
  /**
14
14
  * Print a number of milliseconds in a human-readable format including correct spacing.
15
15
  */
16
- function printAsMs(ms, precision = 2) {
16
+ function printAsMs(ms, precision = 1) {
17
17
  /* eslint-disable-next-line no-irregular-whitespace*/
18
18
  return `${ms.toFixed(precision)} ms`;
19
19
  }
package/util/version.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.flowrVersion = flowrVersion;
4
4
  const semver_1 = require("semver");
5
5
  // this is automatically replaced with the current version by release-it
6
- const version = '2.2.11';
6
+ const version = '2.2.13';
7
7
  function flowrVersion() {
8
8
  return new semver_1.SemVer(version);
9
9
  }
@@ -1,36 +0,0 @@
1
- import type { DataflowGraph, FunctionArgument, OutgoingEdges } from './graph';
2
- import type { GenericDiffConfiguration, GenericDifferenceInformation, WriteableDifferenceReport } from '../../util/diff';
3
- import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
4
- interface ProblematicVertex {
5
- tag: 'vertex';
6
- id: NodeId;
7
- }
8
- interface ProblematicEdge {
9
- tag: 'edge';
10
- from: NodeId;
11
- to: NodeId;
12
- }
13
- export type ProblematicDiffInfo = ProblematicVertex | ProblematicEdge;
14
- export declare class DataflowDifferenceReport implements WriteableDifferenceReport {
15
- _comments: string[] | undefined;
16
- _problematic: ProblematicDiffInfo[] | undefined;
17
- addComment(comment: string, ...related: readonly ProblematicDiffInfo[]): void;
18
- comments(): readonly string[] | undefined;
19
- problematic(): readonly ProblematicDiffInfo[] | undefined;
20
- isEqual(): boolean;
21
- }
22
- export interface NamedGraph {
23
- name: string;
24
- graph: DataflowGraph;
25
- }
26
- interface DataflowDiffContext extends GenericDifferenceInformation<DataflowDifferenceReport> {
27
- left: DataflowGraph;
28
- right: DataflowGraph;
29
- config: GenericDiffConfiguration;
30
- }
31
- export declare function diffOfDataflowGraphs(left: NamedGraph, right: NamedGraph, config?: Partial<GenericDiffConfiguration>): DataflowDifferenceReport;
32
- export declare function equalFunctionArguments(fn: NodeId, a: false | readonly FunctionArgument[], b: false | readonly FunctionArgument[]): boolean;
33
- export declare function diffFunctionArguments(fn: NodeId, a: false | readonly FunctionArgument[], b: false | readonly FunctionArgument[], ctx: GenericDifferenceInformation<DataflowDifferenceReport>): void;
34
- export declare function diffVertices(ctx: DataflowDiffContext): void;
35
- export declare function diffEdges(ctx: DataflowDiffContext, id: NodeId, lEdges: OutgoingEdges | undefined, rEdges: OutgoingEdges | undefined): void;
36
- export {};
@@ -1,7 +0,0 @@
1
- import type { ControlFlowGraph } from './cfg';
2
- import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
3
- import { Ternary } from '../logic';
4
- /**
5
- * Determines if node `a` happens before node `b` in the control flow graph.
6
- */
7
- export declare function happensBefore(cfg: ControlFlowGraph, a: NodeId, b: NodeId): Ternary;
@@ -1,9 +0,0 @@
1
- import type { ControlFlowGraph } from './cfg';
2
- import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
3
- /**
4
- * Visit all nodes reachable from the start node in the control flow graph, traversing the dependencies but ignoring cycles.
5
- * @param graph - The control flow graph.
6
- * @param startNode - The node to start the traversal from.
7
- * @param visitor - The visitor function to call for each node, if you return true the traversal from this node will be stopped.
8
- */
9
- export declare function visitInReverseOrder(graph: ControlFlowGraph, startNode: NodeId, visitor: (node: NodeId) => boolean | void): void;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.visitInReverseOrder = visitInReverseOrder;
4
- /**
5
- * Visit all nodes reachable from the start node in the control flow graph, traversing the dependencies but ignoring cycles.
6
- * @param graph - The control flow graph.
7
- * @param startNode - The node to start the traversal from.
8
- * @param visitor - The visitor function to call for each node, if you return true the traversal from this node will be stopped.
9
- */
10
- function visitInReverseOrder(graph, startNode,
11
- // eslint-disable-next-line @typescript-eslint/no-invalid-void-type -- void is used to indicate that the return value is ignored/we never stop
12
- visitor) {
13
- const visited = new Set();
14
- const queue = [startNode];
15
- while (queue.length > 0) {
16
- const current = queue.pop();
17
- if (visited.has(current)) {
18
- continue;
19
- }
20
- visited.add(current);
21
- if (visitor(current)) {
22
- continue;
23
- }
24
- const incoming = graph.outgoing(current) ?? [];
25
- for (const [from] of incoming) {
26
- queue.push(from);
27
- }
28
- }
29
- }
30
- //# sourceMappingURL=visitor.js.map
package/util/set.js DELETED
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setEquals = setEquals;
4
- exports.setMinus = setMinus;
5
- /**
6
- * Given both sets, this checks if they contain the same elements.
7
- */
8
- function setEquals(a, b) {
9
- if (a.size !== b.size) {
10
- return false;
11
- }
12
- for (const item of a) {
13
- if (!b.has(item)) {
14
- return false;
15
- }
16
- }
17
- return true;
18
- }
19
- /**
20
- * Returns `A – B`
21
- */
22
- function setMinus(a, b) {
23
- const result = new Set();
24
- for (const item of a) {
25
- if (!b.has(item)) {
26
- result.add(item);
27
- }
28
- }
29
- return result;
30
- }
31
- //# sourceMappingURL=set.js.map
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes