@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
@@ -0,0 +1,128 @@
1
+ import type { CfgExpressionVertex, CfgStatementVertex, ControlFlowInformation } from './control-flow-graph';
2
+ import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
3
+ import type { NormalizedAst, ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
4
+ import type { BasicCfgGuidedVisitorConfiguration } from './basic-cfg-guided-visitor';
5
+ import { BasicCfgGuidedVisitor } from './basic-cfg-guided-visitor';
6
+ import type { RAccess } from '../r-bridge/lang-4.x/ast/model/nodes/r-access';
7
+ import type { RArgument } from '../r-bridge/lang-4.x/ast/model/nodes/r-argument';
8
+ import type { RBinaryOp } from '../r-bridge/lang-4.x/ast/model/nodes/r-binary-op';
9
+ import type { RExpressionList } from '../r-bridge/lang-4.x/ast/model/nodes/r-expression-list';
10
+ import type { RForLoop } from '../r-bridge/lang-4.x/ast/model/nodes/r-for-loop';
11
+ import type { RFunctionCall } from '../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
12
+ import type { RFunctionDefinition } from '../r-bridge/lang-4.x/ast/model/nodes/r-function-definition';
13
+ import type { RIfThenElse } from '../r-bridge/lang-4.x/ast/model/nodes/r-if-then-else';
14
+ import type { RParameter } from '../r-bridge/lang-4.x/ast/model/nodes/r-parameter';
15
+ import type { RPipe } from '../r-bridge/lang-4.x/ast/model/nodes/r-pipe';
16
+ import type { RRepeatLoop } from '../r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop';
17
+ import type { RUnaryOp } from '../r-bridge/lang-4.x/ast/model/nodes/r-unary-op';
18
+ import type { RWhileLoop } from '../r-bridge/lang-4.x/ast/model/nodes/r-while-loop';
19
+ import type { RBreak } from '../r-bridge/lang-4.x/ast/model/nodes/r-break';
20
+ import type { RComment } from '../r-bridge/lang-4.x/ast/model/nodes/r-comment';
21
+ import type { RLineDirective } from '../r-bridge/lang-4.x/ast/model/nodes/r-line-directive';
22
+ import type { RLogical } from '../r-bridge/lang-4.x/ast/model/nodes/r-logical';
23
+ import type { RString } from '../r-bridge/lang-4.x/ast/model/nodes/r-string';
24
+ import type { RNext } from '../r-bridge/lang-4.x/ast/model/nodes/r-next';
25
+ import type { RNumber } from '../r-bridge/lang-4.x/ast/model/nodes/r-number';
26
+ import type { RSymbol } from '../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
27
+ import type { NoInfo, RNode } from '../r-bridge/lang-4.x/ast/model/model';
28
+ export interface SyntaxCfgGuidedVisitorConfiguration<OtherInfo = NoInfo, Cfg extends ControlFlowInformation = ControlFlowInformation, Ast extends NormalizedAst<OtherInfo> = NormalizedAst<OtherInfo>> extends BasicCfgGuidedVisitorConfiguration<Cfg> {
29
+ readonly normalizedAst: Ast;
30
+ }
31
+ /**
32
+ * This visitor extends on the {@link BasicCfgGuidedVisitor} by dispatching visitors based on the AST type of the node.
33
+ *
34
+ * Use {@link BasicCfgGuidedVisitor#start} to start the traversal.
35
+ */
36
+ export declare class SyntaxAwareCfgGuidedVisitor<OtherInfo = NoInfo, Cfg extends ControlFlowInformation = ControlFlowInformation, Ast extends NormalizedAst<OtherInfo> = NormalizedAst<OtherInfo>, Config extends SyntaxCfgGuidedVisitorConfiguration<OtherInfo, Cfg, Ast> = SyntaxCfgGuidedVisitorConfiguration<OtherInfo, Cfg, Ast>> extends BasicCfgGuidedVisitor<Cfg, Config> {
37
+ /**
38
+ * Get the normalized AST node for the given id or fail if it does not exist.
39
+ */
40
+ protected getNormalizedAst(id: NodeId): RNode<OtherInfo & ParentInformation> | undefined;
41
+ protected onStatementNode(node: CfgStatementVertex): void;
42
+ protected onExpressionNode(node: CfgExpressionVertex): void;
43
+ private onExprOrStmtNode;
44
+ /**
45
+ * {@link RAccess}
46
+ */
47
+ protected visitRAccess(_node: RAccess<OtherInfo & ParentInformation>): void;
48
+ /**
49
+ * {@link RArgument}
50
+ */
51
+ protected visitRArgument(_node: RArgument<OtherInfo & ParentInformation>): void;
52
+ /**
53
+ * {@link RBinaryOp}
54
+ */
55
+ protected visitRBinaryOp(_node: RBinaryOp<OtherInfo & ParentInformation>): void;
56
+ /**
57
+ * {@link RExpressionList}
58
+ */
59
+ protected visitRExpressionList(_node: RExpressionList<OtherInfo & ParentInformation>): void;
60
+ /**
61
+ * {@link RForLoop}
62
+ */
63
+ protected visitRForLoop(_node: RForLoop<OtherInfo & ParentInformation>): void;
64
+ /**
65
+ * {@link RFunctionCall}
66
+ */
67
+ protected visitRFunctionCall(_node: RFunctionCall<OtherInfo & ParentInformation>): void;
68
+ /**
69
+ * {@link RFunctionDefinition}
70
+ */
71
+ protected visitRFunctionDefinition(_node: RFunctionDefinition<OtherInfo & ParentInformation>): void;
72
+ /**
73
+ * {@link RIfThenElse}
74
+ */
75
+ protected visitRIfThenElse(_node: RIfThenElse<OtherInfo & ParentInformation>): void;
76
+ /**
77
+ * {@link RParameter}
78
+ */
79
+ protected visitRParameter(_node: RParameter<OtherInfo & ParentInformation>): void;
80
+ /**
81
+ * {@link RPipe}
82
+ */
83
+ protected visitRPipe(_node: RPipe<OtherInfo & ParentInformation>): void;
84
+ /**
85
+ * {@link RRepeatLoop}
86
+ */
87
+ protected visitRRepeatLoop(_node: RRepeatLoop<OtherInfo & ParentInformation>): void;
88
+ /**
89
+ * {@link RUnaryOp}
90
+ */
91
+ protected visitRUnaryOp(_node: RUnaryOp<OtherInfo & ParentInformation>): void;
92
+ /**
93
+ * {@link RWhileLoop}
94
+ */
95
+ protected visitRWhileLoop(_node: RWhileLoop<OtherInfo & ParentInformation>): void;
96
+ /**
97
+ * {@link RBreak}
98
+ */
99
+ protected visitRBreak(_node: RBreak<OtherInfo & ParentInformation>): void;
100
+ /**
101
+ * {@link RComment}
102
+ */
103
+ protected visitRComment(_node: RComment<OtherInfo & ParentInformation>): void;
104
+ /**
105
+ * {@link RLineDirective}
106
+ */
107
+ protected visitRLineDirective(_node: RLineDirective<OtherInfo & ParentInformation>): void;
108
+ /**
109
+ * {@link RLogical}
110
+ */
111
+ protected visitRLogical(_node: RLogical<OtherInfo & ParentInformation>): void;
112
+ /**
113
+ * {@link RNext}
114
+ */
115
+ protected visitRNext(_node: RNext<OtherInfo & ParentInformation>): void;
116
+ /**
117
+ * {@link RNumber}
118
+ */
119
+ protected visitRNumber(_node: RNumber<OtherInfo & ParentInformation>): void;
120
+ /**
121
+ * {@link RString}
122
+ */
123
+ protected visitRString(_node: RString<OtherInfo & ParentInformation>): void;
124
+ /**
125
+ * {@link RSymbol}
126
+ */
127
+ protected visitRSymbol(_node: RSymbol<OtherInfo & ParentInformation>): void;
128
+ }
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SyntaxAwareCfgGuidedVisitor = void 0;
4
+ const basic_cfg_guided_visitor_1 = require("./basic-cfg-guided-visitor");
5
+ const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
6
+ const assert_1 = require("../util/assert");
7
+ /**
8
+ * This visitor extends on the {@link BasicCfgGuidedVisitor} by dispatching visitors based on the AST type of the node.
9
+ *
10
+ * Use {@link BasicCfgGuidedVisitor#start} to start the traversal.
11
+ */
12
+ class SyntaxAwareCfgGuidedVisitor extends basic_cfg_guided_visitor_1.BasicCfgGuidedVisitor {
13
+ /**
14
+ * Get the normalized AST node for the given id or fail if it does not exist.
15
+ */
16
+ getNormalizedAst(id) {
17
+ return this.config.normalizedAst.idMap.get(id);
18
+ }
19
+ onStatementNode(node) {
20
+ super.onStatementNode(node);
21
+ this.onExprOrStmtNode(node);
22
+ }
23
+ onExpressionNode(node) {
24
+ super.onExpressionNode(node);
25
+ this.onExprOrStmtNode(node);
26
+ }
27
+ onExprOrStmtNode(node) {
28
+ const astVertex = this.getNormalizedAst(node.id);
29
+ if (!astVertex) {
30
+ return;
31
+ }
32
+ const type = astVertex.type;
33
+ switch (type) {
34
+ case type_1.RType.Access:
35
+ return this.visitRAccess(astVertex);
36
+ case type_1.RType.Argument:
37
+ return this.visitRArgument(astVertex);
38
+ case type_1.RType.BinaryOp:
39
+ return this.visitRBinaryOp(astVertex);
40
+ case type_1.RType.ExpressionList:
41
+ return this.visitRExpressionList(astVertex);
42
+ case type_1.RType.ForLoop:
43
+ return this.visitRForLoop(astVertex);
44
+ case type_1.RType.FunctionCall:
45
+ return this.visitRFunctionCall(astVertex);
46
+ case type_1.RType.FunctionDefinition:
47
+ return this.visitRFunctionDefinition(astVertex);
48
+ case type_1.RType.IfThenElse:
49
+ return this.visitRIfThenElse(astVertex);
50
+ case type_1.RType.Parameter:
51
+ return this.visitRParameter(astVertex);
52
+ case type_1.RType.Pipe:
53
+ return this.visitRPipe(astVertex);
54
+ case type_1.RType.RepeatLoop:
55
+ return this.visitRRepeatLoop(astVertex);
56
+ case type_1.RType.UnaryOp:
57
+ return this.visitRUnaryOp(astVertex);
58
+ case type_1.RType.WhileLoop:
59
+ return this.visitRWhileLoop(astVertex);
60
+ case type_1.RType.Break:
61
+ return this.visitRBreak(astVertex);
62
+ case type_1.RType.Comment:
63
+ return this.visitRComment(astVertex);
64
+ case type_1.RType.LineDirective:
65
+ return this.visitRLineDirective(astVertex);
66
+ case type_1.RType.Logical:
67
+ return this.visitRLogical(astVertex);
68
+ case type_1.RType.Next:
69
+ return this.visitRNext(astVertex);
70
+ case type_1.RType.Number:
71
+ return this.visitRNumber(astVertex);
72
+ case type_1.RType.String:
73
+ return this.visitRString(astVertex);
74
+ case type_1.RType.Symbol:
75
+ return this.visitRSymbol(astVertex);
76
+ default:
77
+ (0, assert_1.assertUnreachable)(type);
78
+ }
79
+ }
80
+ /**
81
+ * {@link RAccess}
82
+ */
83
+ visitRAccess(_node) { }
84
+ /**
85
+ * {@link RArgument}
86
+ */
87
+ visitRArgument(_node) { }
88
+ /**
89
+ * {@link RBinaryOp}
90
+ */
91
+ visitRBinaryOp(_node) { }
92
+ /**
93
+ * {@link RExpressionList}
94
+ */
95
+ visitRExpressionList(_node) { }
96
+ /**
97
+ * {@link RForLoop}
98
+ */
99
+ visitRForLoop(_node) { }
100
+ /**
101
+ * {@link RFunctionCall}
102
+ */
103
+ visitRFunctionCall(_node) { }
104
+ /**
105
+ * {@link RFunctionDefinition}
106
+ */
107
+ visitRFunctionDefinition(_node) { }
108
+ /**
109
+ * {@link RIfThenElse}
110
+ */
111
+ visitRIfThenElse(_node) { }
112
+ /**
113
+ * {@link RParameter}
114
+ */
115
+ visitRParameter(_node) { }
116
+ /**
117
+ * {@link RPipe}
118
+ */
119
+ visitRPipe(_node) { }
120
+ /**
121
+ * {@link RRepeatLoop}
122
+ */
123
+ visitRRepeatLoop(_node) { }
124
+ /**
125
+ * {@link RUnaryOp}
126
+ */
127
+ visitRUnaryOp(_node) { }
128
+ /**
129
+ * {@link RWhileLoop}
130
+ */
131
+ visitRWhileLoop(_node) { }
132
+ /**
133
+ * {@link RBreak}
134
+ */
135
+ visitRBreak(_node) { }
136
+ /**
137
+ * {@link RComment}
138
+ */
139
+ visitRComment(_node) { }
140
+ /**
141
+ * {@link RLineDirective}
142
+ */
143
+ visitRLineDirective(_node) { }
144
+ /**
145
+ * {@link RLogical}
146
+ */
147
+ visitRLogical(_node) { }
148
+ /**
149
+ * {@link RNext}
150
+ */
151
+ visitRNext(_node) { }
152
+ /**
153
+ * {@link RNumber}
154
+ */
155
+ visitRNumber(_node) { }
156
+ /**
157
+ * {@link RString}
158
+ */
159
+ visitRString(_node) { }
160
+ /**
161
+ * {@link RSymbol}
162
+ */
163
+ visitRSymbol(_node) { }
164
+ }
165
+ exports.SyntaxAwareCfgGuidedVisitor = SyntaxAwareCfgGuidedVisitor;
166
+ //# sourceMappingURL=syntax-cfg-guided-visitor.js.map
@@ -1,5 +1,5 @@
1
1
  import type { IPipelineStep, StepProcessingFunction } from '../steps/pipeline-step';
2
- import type { TailOfArray } from '../../util/arrays';
2
+ import type { TailOfArray } from '../../util/collections/arrays';
3
3
  /**
4
4
  * Defines the output format of a step that you are interested in.
5
5
  */
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sliceDiffAnsi = sliceDiffAnsi;
4
4
  const range_1 = require("../../util/range");
5
5
  const assert_1 = require("../../util/assert");
6
- const ansi_1 = require("../../util/ansi");
6
+ const ansi_1 = require("../../util/text/ansi");
7
7
  function grayOut() {
8
8
  return ansi_1.ansiFormatter.getFormatString({ color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground, style: 2 /* FontStyles.Faint */ });
9
9
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.verifyAndBuildPipeline = verifyAndBuildPipeline;
4
4
  const invalid_pipeline_error_1 = require("./invalid-pipeline-error");
5
5
  const json_1 = require("../../../util/json");
6
- const arrays_1 = require("../../../util/arrays");
6
+ const arrays_1 = require("../../../util/collections/arrays");
7
7
  /**
8
8
  * Given a set of {@link IPipelineStep|steps} with their dependencies, this function verifies all requirements of {@link createPipeline}.
9
9
  */
@@ -26,7 +26,7 @@ export interface BuiltInConstantDefinition<Value> extends BaseBuiltInDefinition
26
26
  export interface BuiltInFunctionDefinition<BuiltInProcessor extends BuiltInMappingName> extends BaseBuiltInDefinition {
27
27
  readonly type: 'function';
28
28
  readonly processor: BuiltInProcessor;
29
- readonly config: ConfigOfBuiltInMappingName<BuiltInProcessor>;
29
+ readonly config?: ConfigOfBuiltInMappingName<BuiltInProcessor>;
30
30
  }
31
31
  /**
32
32
  * Define a built-in replacement (like `[` or `$`) and the processor to use.
@@ -35,6 +35,9 @@ export interface BuiltInFunctionDefinition<BuiltInProcessor extends BuiltInMappi
35
35
  export interface BuiltInReplacementDefinition extends BaseBuiltInDefinition {
36
36
  readonly type: 'replacement';
37
37
  readonly suffixes: readonly ('<<-' | '<-')[];
38
+ readonly config: {
39
+ readIndices: boolean;
40
+ };
38
41
  }
39
42
  export type BuiltInDefinition = BuiltInConstantDefinition<any> | BuiltInFunctionDefinition<any> | BuiltInReplacementDefinition;
40
43
  /**
@@ -42,6 +45,6 @@ export type BuiltInDefinition = BuiltInConstantDefinition<any> | BuiltInFunction
42
45
  */
43
46
  export type BuiltInDefinitions = readonly BuiltInDefinition[];
44
47
  export declare function registerBuiltInFunctions<BuiltInProcessor extends BuiltInMappingName>({ names, processor, config, assumePrimitive }: BuiltInFunctionDefinition<BuiltInProcessor>): void;
45
- export declare function registerReplacementFunctions({ names, suffixes, assumePrimitive }: BuiltInReplacementDefinition): void;
48
+ export declare function registerReplacementFunctions({ names, suffixes, assumePrimitive, config }: BuiltInReplacementDefinition): void;
46
49
  export declare function registerBuiltInDefinition(definition: BuiltInDefinition): void;
47
50
  export declare function registerBuiltInDefinitions(definitions: BuiltInDefinitions): void;
@@ -9,13 +9,14 @@ const identifier_1 = require("./identifier");
9
9
  const assert_1 = require("../../util/assert");
10
10
  function registerBuiltInConstant({ names, value, assumePrimitive }) {
11
11
  for (const name of names) {
12
+ const id = (0, built_in_1.builtInId)(name);
12
13
  const d = [{
13
14
  type: identifier_1.ReferenceType.BuiltInConstant,
14
- definedAt: built_in_1.BuiltIn,
15
+ definedAt: id,
15
16
  controlDependencies: undefined,
16
17
  value,
17
18
  name,
18
- nodeId: built_in_1.BuiltIn
19
+ nodeId: id
19
20
  }];
20
21
  built_in_1.BuiltInMemory.set(name, d);
21
22
  if (assumePrimitive) {
@@ -28,14 +29,16 @@ function registerBuiltInFunctions({ names, processor, config, assumePrimitive })
28
29
  (0, assert_1.guard)(mappedProcessor !== undefined, () => `Processor for ${processor} is undefined! Please pass a valid builtin name ${JSON.stringify(Object.keys(built_in_1.BuiltInProcessorMapper))}!`);
29
30
  for (const name of names) {
30
31
  (0, assert_1.guard)(processor !== undefined, `Processor for ${name} is undefined, maybe you have an import loop? You may run 'npm run detect-circular-deps' - although by far not all are bad`);
32
+ const id = (0, built_in_1.builtInId)(name);
31
33
  const d = [{
32
34
  type: identifier_1.ReferenceType.BuiltInFunction,
33
- definedAt: built_in_1.BuiltIn,
35
+ definedAt: id,
34
36
  controlDependencies: undefined,
35
37
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-argument */
36
38
  processor: (name, args, rootId, data) => mappedProcessor(name, args, rootId, data, config),
39
+ config,
37
40
  name,
38
- nodeId: built_in_1.BuiltIn
41
+ nodeId: id
39
42
  }];
40
43
  built_in_1.BuiltInMemory.set(name, d);
41
44
  if (assumePrimitive) {
@@ -44,19 +47,25 @@ function registerBuiltInFunctions({ names, processor, config, assumePrimitive })
44
47
  }
45
48
  }
46
49
  /* registers all combinations of replacements */
47
- function registerReplacementFunctions({ names, suffixes, assumePrimitive }) {
50
+ function registerReplacementFunctions({ names, suffixes, assumePrimitive, config }) {
48
51
  const replacer = built_in_1.BuiltInProcessorMapper['builtin:replacement'];
49
52
  (0, assert_1.guard)(replacer !== undefined, () => 'Processor for builtin:replacement is undefined!');
50
53
  for (const assignment of names) {
51
54
  for (const suffix of suffixes) {
52
55
  const effectiveName = `${assignment}${suffix}`;
56
+ const id = (0, built_in_1.builtInId)(effectiveName);
53
57
  const d = [{
54
58
  type: identifier_1.ReferenceType.BuiltInFunction,
55
- definedAt: built_in_1.BuiltIn,
56
- processor: (name, args, rootId, data) => replacer(name, args, rootId, data, { makeMaybe: true, assignmentOperator: suffix }),
59
+ definedAt: id,
60
+ processor: (name, args, rootId, data) => replacer(name, args, rootId, data, { makeMaybe: true, assignmentOperator: suffix, readIndices: config.readIndices }),
61
+ config: {
62
+ ...config,
63
+ assignmentOperator: suffix,
64
+ makeMaybe: true
65
+ },
57
66
  name: effectiveName,
58
67
  controlDependencies: undefined,
59
- nodeId: built_in_1.BuiltIn
68
+ nodeId: id
60
69
  }];
61
70
  built_in_1.BuiltInMemory.set(effectiveName, d);
62
71
  if (assumePrimitive) {
@@ -1,5 +1,5 @@
1
1
  import type { DataflowProcessorInformation } from '../processor';
2
- import type { ExitPointType, DataflowInformation } from '../info';
2
+ import type { DataflowInformation, ExitPointType } from '../info';
3
3
  import { processAccess } from '../internal/process/functions/call/built-in/built-in-access';
4
4
  import { processIfThenElse } from '../internal/process/functions/call/built-in/built-in-if-then-else';
5
5
  import { processAssignment } from '../internal/process/functions/call/built-in/built-in-assignment';
@@ -25,17 +25,23 @@ import type { ForceArguments } from '../internal/process/functions/call/common';
25
25
  import { processApply } from '../internal/process/functions/call/built-in/built-in-apply';
26
26
  import type { LinkTo } from '../../queries/catalog/call-context-query/call-context-query-format';
27
27
  import { processList } from '../internal/process/functions/call/built-in/built-in-list';
28
- export declare const BuiltIn = "built-in";
28
+ import { processVector } from '../internal/process/functions/call/built-in/built-in-vector';
29
+ import { processRm } from '../internal/process/functions/call/built-in/built-in-rm';
30
+ import { processEvalCall } from '../internal/process/functions/call/built-in/built-in-eval';
31
+ export type BuiltIn = `built-in:${string}`;
32
+ export declare function builtInId(name: string): BuiltIn;
33
+ export declare function isBuiltIn(name: NodeId | string): name is BuiltIn;
29
34
  export type BuiltInIdentifierProcessor = <OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>) => DataflowInformation;
30
35
  export type BuiltInIdentifierProcessorWithConfig<Config> = <OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: Config) => DataflowInformation;
31
36
  export interface BuiltInIdentifierDefinition extends IdentifierReference {
32
37
  type: ReferenceType.BuiltInFunction;
33
- definedAt: typeof BuiltIn;
38
+ definedAt: BuiltIn;
34
39
  processor: BuiltInIdentifierProcessor;
40
+ config?: object;
35
41
  }
36
42
  export interface BuiltInIdentifierConstant<T = unknown> extends IdentifierReference {
37
43
  type: ReferenceType.BuiltInConstant;
38
- definedAt: typeof BuiltIn;
44
+ definedAt: BuiltIn;
39
45
  value: T;
40
46
  }
41
47
  export interface DefaultBuiltInProcessorConfiguration extends ForceArguments {
@@ -43,17 +49,21 @@ export interface DefaultBuiltInProcessorConfiguration extends ForceArguments {
43
49
  readonly cfg?: ExitPointType;
44
50
  readonly readAllArguments?: boolean;
45
51
  readonly hasUnknownSideEffects?: boolean | LinkTo<RegExp | string>;
52
+ /** record mapping the actual function name called to the arguments that should be treated as function calls */
53
+ readonly treatAsFnCall?: Record<string, readonly string[]>;
46
54
  }
47
55
  declare function defaultBuiltInProcessor<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly RFunctionArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: DefaultBuiltInProcessorConfiguration): DataflowInformation;
48
- export declare function registerBuiltInFunctions<Config, Proc extends BuiltInIdentifierProcessorWithConfig<Config>>(both: boolean, names: readonly Identifier[], processor: Proc, config: Config): void;
56
+ export declare function registerBuiltInFunctions<Config extends object, Proc extends BuiltInIdentifierProcessorWithConfig<Config>>(both: boolean, names: readonly Identifier[], processor: Proc, config: Config): void;
49
57
  export declare const BuiltInProcessorMapper: {
50
58
  readonly 'builtin:default': typeof defaultBuiltInProcessor;
59
+ readonly 'builtin:eval': typeof processEvalCall;
51
60
  readonly 'builtin:apply': typeof processApply;
52
61
  readonly 'builtin:expression-list': typeof processExpressionList;
53
62
  readonly 'builtin:source': typeof processSourceCall;
54
63
  readonly 'builtin:access': typeof processAccess;
55
64
  readonly 'builtin:if-then-else': typeof processIfThenElse;
56
65
  readonly 'builtin:get': typeof processGet;
66
+ readonly 'builtin:rm': typeof processRm;
57
67
  readonly 'builtin:library': typeof processLibrary;
58
68
  readonly 'builtin:assignment': typeof processAssignment;
59
69
  readonly 'builtin:special-bin-op': typeof processSpecialBinOp;
@@ -65,6 +75,7 @@ export declare const BuiltInProcessorMapper: {
65
75
  readonly 'builtin:while-loop': typeof processWhileLoop;
66
76
  readonly 'builtin:replacement': typeof processReplacementFunction;
67
77
  readonly 'builtin:list': typeof processList;
78
+ readonly 'builtin:vector': typeof processVector;
68
79
  };
69
80
  export type BuiltInMappingName = keyof typeof BuiltInProcessorMapper;
70
81
  export type ConfigOfBuiltInMappingName<N extends BuiltInMappingName> = Parameters<typeof BuiltInProcessorMapper[N]>[4];
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EmptyBuiltInMemory = exports.BuiltInMemory = exports.BuiltInProcessorMapper = exports.BuiltIn = void 0;
3
+ exports.EmptyBuiltInMemory = exports.BuiltInMemory = exports.BuiltInProcessorMapper = void 0;
4
+ exports.builtInId = builtInId;
5
+ exports.isBuiltIn = isBuiltIn;
4
6
  exports.registerBuiltInFunctions = registerBuiltInFunctions;
5
7
  const known_call_handling_1 = require("../internal/process/functions/call/known-call-handling");
6
8
  const built_in_access_1 = require("../internal/process/functions/call/built-in/built-in-access");
@@ -18,6 +20,7 @@ const built_in_quote_1 = require("../internal/process/functions/call/built-in/bu
18
20
  const built_in_function_definition_1 = require("../internal/process/functions/call/built-in/built-in-function-definition");
19
21
  const built_in_expression_list_1 = require("../internal/process/functions/call/built-in/built-in-expression-list");
20
22
  const built_in_get_1 = require("../internal/process/functions/call/built-in/built-in-get");
23
+ const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
21
24
  const edge_1 = require("../graph/edge");
22
25
  const built_in_library_1 = require("../internal/process/functions/call/built-in/built-in-library");
23
26
  const built_in_source_1 = require("../internal/process/functions/call/built-in/built-in-source");
@@ -25,9 +28,19 @@ const built_in_apply_1 = require("../internal/process/functions/call/built-in/bu
25
28
  const built_in_config_1 = require("./built-in-config");
26
29
  const default_builtin_config_1 = require("./default-builtin-config");
27
30
  const built_in_list_1 = require("../internal/process/functions/call/built-in/built-in-list");
28
- exports.BuiltIn = 'built-in';
31
+ const built_in_vector_1 = require("../internal/process/functions/call/built-in/built-in-vector");
32
+ const built_in_rm_1 = require("../internal/process/functions/call/built-in/built-in-rm");
33
+ const built_in_eval_1 = require("../internal/process/functions/call/built-in/built-in-eval");
34
+ const vertex_1 = require("../graph/vertex");
35
+ const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
36
+ function builtInId(name) {
37
+ return `built-in:${name}`;
38
+ }
39
+ function isBuiltIn(name) {
40
+ return String(name).startsWith('built-in:');
41
+ }
29
42
  function defaultBuiltInProcessor(name, args, rootId, data, config) {
30
- const { information: res, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs });
43
+ const { information: res, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin: 'builtin:default' });
31
44
  if (config.returnsNthArgument !== undefined) {
32
45
  const arg = config.returnsNthArgument === 'last' ? processedArguments[args.length - 1] : processedArguments[config.returnsNthArgument];
33
46
  if (arg !== undefined) {
@@ -49,6 +62,37 @@ function defaultBuiltInProcessor(name, args, rootId, data, config) {
49
62
  res.graph.markIdForUnknownSideEffects(rootId);
50
63
  }
51
64
  }
65
+ const fnCallNames = config.treatAsFnCall?.[name.content];
66
+ if (fnCallNames) {
67
+ for (const arg of args) {
68
+ if (arg !== r_function_call_1.EmptyArgument && arg.value && fnCallNames.includes(arg.name?.content)) {
69
+ const rhs = arg.value;
70
+ let fnName;
71
+ let fnId;
72
+ if (rhs.type === type_1.RType.String) {
73
+ fnName = rhs.content.str;
74
+ fnId = rhs.info.id;
75
+ }
76
+ else if (rhs.type === type_1.RType.Symbol) {
77
+ fnName = rhs.content;
78
+ fnId = rhs.info.id;
79
+ }
80
+ else {
81
+ continue;
82
+ }
83
+ res.graph.updateToFunctionCall({
84
+ tag: vertex_1.VertexType.FunctionCall,
85
+ id: fnId,
86
+ name: fnName,
87
+ args: [],
88
+ environment: data.environment,
89
+ onlyBuiltin: false,
90
+ cds: data.controlDependencies,
91
+ origin: ['builtin:default']
92
+ });
93
+ }
94
+ }
95
+ }
52
96
  if (config.cfg !== undefined) {
53
97
  res.exitPoints = [...res.exitPoints, { type: config.cfg, nodeId: rootId, controlDependencies: data.controlDependencies }];
54
98
  }
@@ -57,13 +101,15 @@ function defaultBuiltInProcessor(name, args, rootId, data, config) {
57
101
  function registerBuiltInFunctions(both, names, processor, config) {
58
102
  for (const name of names) {
59
103
  (0, assert_1.guard)(processor !== undefined, `Processor for ${name} is undefined, maybe you have an import loop? You may run 'npm run detect-circular-deps' - although by far not all are bad`);
104
+ const id = builtInId(name);
60
105
  const d = [{
61
106
  type: identifier_1.ReferenceType.BuiltInFunction,
62
- definedAt: exports.BuiltIn,
107
+ definedAt: id,
63
108
  controlDependencies: undefined,
64
109
  processor: (name, args, rootId, data) => processor(name, args, rootId, data, config),
110
+ config,
65
111
  name,
66
- nodeId: exports.BuiltIn
112
+ nodeId: id
67
113
  }];
68
114
  exports.BuiltInMemory.set(name, d);
69
115
  if (both) {
@@ -73,12 +119,14 @@ function registerBuiltInFunctions(both, names, processor, config) {
73
119
  }
74
120
  exports.BuiltInProcessorMapper = {
75
121
  'builtin:default': defaultBuiltInProcessor,
122
+ 'builtin:eval': built_in_eval_1.processEvalCall,
76
123
  'builtin:apply': built_in_apply_1.processApply,
77
124
  'builtin:expression-list': built_in_expression_list_1.processExpressionList,
78
125
  'builtin:source': built_in_source_1.processSourceCall,
79
126
  'builtin:access': built_in_access_1.processAccess,
80
127
  'builtin:if-then-else': built_in_if_then_else_1.processIfThenElse,
81
128
  'builtin:get': built_in_get_1.processGet,
129
+ 'builtin:rm': built_in_rm_1.processRm,
82
130
  'builtin:library': built_in_library_1.processLibrary,
83
131
  'builtin:assignment': built_in_assignment_1.processAssignment,
84
132
  'builtin:special-bin-op': built_in_special_bin_op_1.processSpecialBinOp,
@@ -89,7 +137,8 @@ exports.BuiltInProcessorMapper = {
89
137
  'builtin:repeat-loop': built_in_repeat_loop_1.processRepeatLoop,
90
138
  'builtin:while-loop': built_in_while_loop_1.processWhileLoop,
91
139
  'builtin:replacement': built_in_replacement_1.processReplacementFunction,
92
- 'builtin:list': built_in_list_1.processList
140
+ 'builtin:list': built_in_list_1.processList,
141
+ 'builtin:vector': built_in_vector_1.processVector,
93
142
  };
94
143
  exports.BuiltInMemory = new Map();
95
144
  exports.EmptyBuiltInMemory = new Map();
@@ -1,2 +1,7 @@
1
1
  import type { REnvironmentInformation } from './environment';
2
+ /**
3
+ * Produce a clone of the given environment information.
4
+ * @param environment - The environment information to clone.
5
+ * @param recurseParents - Whether to clone the parent environments as well.
6
+ */
2
7
  export declare function cloneEnvironmentInformation(environment: REnvironmentInformation, recurseParents?: boolean): REnvironmentInformation;
@@ -14,6 +14,11 @@ function cloneEnvironment(environment, recurseParents) {
14
14
  clone.memory = new Map(JSON.parse(JSON.stringify([...environment.memory])));
15
15
  return clone;
16
16
  }
17
+ /**
18
+ * Produce a clone of the given environment information.
19
+ * @param environment - The environment information to clone.
20
+ * @param recurseParents - Whether to clone the parent environments as well.
21
+ */
17
22
  function cloneEnvironmentInformation(environment, recurseParents = true) {
18
23
  return {
19
24
  current: cloneEnvironment(environment.current, recurseParents),
@@ -1,5 +1,7 @@
1
1
  import type { BuiltInDefinitions } from './built-in-config';
2
+ import type { BuiltInMappingName } from './built-in';
2
3
  /**
3
4
  * Contains the built-in definitions recognized by flowR
4
5
  */
5
6
  export declare const DefaultBuiltinConfig: BuiltInDefinitions;
7
+ export declare function getDefaultProcessor(name: string): BuiltInMappingName | 'unnamed' | undefined;