@eagleoutice/flowr 2.5.0 → 2.6.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 (254) hide show
  1. package/README.md +46 -35
  2. package/abstract-interpretation/data-frame/absint-visitor.d.ts +1 -1
  3. package/abstract-interpretation/data-frame/absint-visitor.js +1 -1
  4. package/cli/flowr.js +11 -33
  5. package/cli/repl/commands/repl-cfg.d.ts +5 -5
  6. package/cli/repl/commands/repl-cfg.js +21 -22
  7. package/cli/repl/commands/repl-commands.d.ts +3 -3
  8. package/cli/repl/commands/repl-commands.js +2 -0
  9. package/cli/repl/commands/repl-dataflow.d.ts +5 -5
  10. package/cli/repl/commands/repl-dataflow.js +27 -30
  11. package/cli/repl/commands/repl-execute.d.ts +1 -1
  12. package/cli/repl/commands/repl-execute.js +8 -7
  13. package/cli/repl/commands/repl-lineage.d.ts +2 -2
  14. package/cli/repl/commands/repl-lineage.js +11 -11
  15. package/cli/repl/commands/repl-main.d.ts +35 -7
  16. package/cli/repl/commands/repl-normalize.d.ts +3 -3
  17. package/cli/repl/commands/repl-normalize.js +15 -19
  18. package/cli/repl/commands/repl-parse.d.ts +2 -2
  19. package/cli/repl/commands/repl-parse.js +14 -8
  20. package/cli/repl/commands/repl-query.d.ts +3 -3
  21. package/cli/repl/commands/repl-query.js +29 -19
  22. package/cli/repl/commands/repl-quit.js +1 -0
  23. package/cli/repl/commands/repl-version.d.ts +1 -16
  24. package/cli/repl/commands/repl-version.js +2 -18
  25. package/cli/repl/core.d.ts +12 -9
  26. package/cli/repl/core.js +26 -12
  27. package/cli/repl/print-version.js +2 -2
  28. package/cli/repl/server/connection.d.ts +7 -3
  29. package/cli/repl/server/connection.js +46 -50
  30. package/cli/repl/server/messages/message-hello.d.ts +1 -1
  31. package/cli/repl/server/messages/message-slice.d.ts +1 -1
  32. package/cli/repl/server/server.js +2 -2
  33. package/cli/slicer-app.js +1 -1
  34. package/config.d.ts +1 -1
  35. package/config.js +4 -1
  36. package/control-flow/extract-cfg.d.ts +1 -1
  37. package/control-flow/extract-cfg.js +1 -1
  38. package/core/pipeline-executor.d.ts +5 -0
  39. package/core/pipeline-executor.js +5 -0
  40. package/core/steps/all/core/20-dataflow.d.ts +3 -1
  41. package/core/steps/pipeline/create-pipeline.js +1 -1
  42. package/core/steps/pipeline/default-pipelines.d.ts +24 -8
  43. package/core/steps/pipeline/default-pipelines.js +4 -1
  44. package/dataflow/environments/default-builtin-config.js +8 -0
  45. package/dataflow/eval/resolve/alias-tracking.js +2 -0
  46. package/dataflow/eval/resolve/resolve.js +3 -0
  47. package/dataflow/eval/values/r-value.d.ts +4 -1
  48. package/dataflow/eval/values/r-value.js +2 -0
  49. package/dataflow/extractor.d.ts +4 -1
  50. package/dataflow/extractor.js +7 -5
  51. package/dataflow/fn/higher-order-function.d.ts +9 -0
  52. package/dataflow/fn/higher-order-function.js +75 -0
  53. package/dataflow/graph/dataflowgraph-builder.d.ts +11 -12
  54. package/dataflow/graph/dataflowgraph-builder.js +6 -6
  55. package/documentation/doc-util/doc-query.d.ts +3 -6
  56. package/documentation/doc-util/doc-query.js +5 -17
  57. package/documentation/doc-util/doc-repl.js +5 -2
  58. package/documentation/doc-util/doc-search.js +7 -10
  59. package/documentation/doc-util/doc-structure.d.ts +4 -0
  60. package/documentation/doc-util/doc-structure.js +28 -0
  61. package/documentation/doc-util/doc-types.d.ts +5 -1
  62. package/documentation/doc-util/doc-types.js +29 -3
  63. package/documentation/print-analyzer-wiki.d.ts +1 -0
  64. package/documentation/print-analyzer-wiki.js +137 -0
  65. package/documentation/print-core-wiki.d.ts +2 -1
  66. package/documentation/print-core-wiki.js +58 -4
  67. package/documentation/print-dataflow-graph-wiki.js +16 -23
  68. package/documentation/print-interface-wiki.js +18 -1
  69. package/documentation/print-linter-wiki.js +5 -1
  70. package/documentation/print-normalized-ast-wiki.js +6 -8
  71. package/documentation/print-query-wiki.js +20 -0
  72. package/documentation/print-readme.js +1 -1
  73. package/engines.d.ts +9 -0
  74. package/engines.js +38 -0
  75. package/linter/linter-executor.d.ts +2 -8
  76. package/linter/linter-executor.js +9 -4
  77. package/linter/linter-format.d.ts +8 -9
  78. package/linter/linter-rules.d.ts +57 -15
  79. package/linter/linter-rules.js +2 -0
  80. package/linter/rules/absolute-path.d.ts +1 -0
  81. package/linter/rules/dataframe-access-validation.d.ts +4 -3
  82. package/linter/rules/dataframe-access-validation.js +7 -4
  83. package/linter/rules/dead-code.d.ts +2 -1
  84. package/linter/rules/deprecated-functions.d.ts +15 -28
  85. package/linter/rules/deprecated-functions.js +5 -43
  86. package/linter/rules/file-path-validity.d.ts +2 -1
  87. package/linter/rules/file-path-validity.js +1 -1
  88. package/linter/rules/function-finder-util.d.ts +51 -0
  89. package/linter/rules/function-finder-util.js +77 -0
  90. package/linter/rules/naming-convention.d.ts +2 -1
  91. package/linter/rules/network-functions.d.ts +40 -0
  92. package/linter/rules/network-functions.js +24 -0
  93. package/linter/rules/seeded-randomness.d.ts +2 -1
  94. package/linter/rules/unused-definition.d.ts +2 -1
  95. package/linter/rules/useless-loop.d.ts +3 -2
  96. package/linter/rules/useless-loop.js +4 -6
  97. package/package.json +2 -1
  98. package/project/cache/flowr-analyzer-cache.d.ts +94 -0
  99. package/project/cache/flowr-analyzer-cache.js +164 -0
  100. package/project/cache/flowr-cache.d.ts +28 -0
  101. package/project/cache/flowr-cache.js +49 -0
  102. package/project/cfg-kind.d.ts +17 -0
  103. package/project/cfg-kind.js +22 -0
  104. package/project/context/abstract-flowr-analyzer-context.d.ts +39 -0
  105. package/project/context/abstract-flowr-analyzer-context.js +46 -0
  106. package/project/context/flowr-analyzer-context.d.ts +54 -0
  107. package/project/context/flowr-analyzer-context.js +58 -0
  108. package/project/context/flowr-analyzer-dependencies-context.d.ts +39 -0
  109. package/project/context/flowr-analyzer-dependencies-context.js +43 -0
  110. package/project/context/flowr-analyzer-files-context.d.ts +87 -0
  111. package/project/context/flowr-analyzer-files-context.js +134 -0
  112. package/project/context/flowr-analyzer-loading-order-context.d.ts +77 -0
  113. package/project/context/flowr-analyzer-loading-order-context.js +96 -0
  114. package/project/context/flowr-file.d.ts +89 -0
  115. package/project/context/flowr-file.js +78 -0
  116. package/project/flowr-analyzer-builder.d.ts +106 -0
  117. package/project/flowr-analyzer-builder.js +197 -0
  118. package/project/flowr-analyzer.d.ts +126 -0
  119. package/project/flowr-analyzer.js +88 -0
  120. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +17 -0
  121. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +28 -0
  122. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +21 -0
  123. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +34 -0
  124. package/project/plugins/file-plugins/flowr-description-file.d.ts +24 -0
  125. package/project/plugins/file-plugins/flowr-description-file.js +38 -0
  126. package/project/plugins/flowr-analyzer-plugin.d.ts +90 -0
  127. package/project/plugins/flowr-analyzer-plugin.js +82 -0
  128. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.d.ts +14 -0
  129. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +56 -0
  130. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.d.ts +13 -0
  131. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-plugin.js +33 -0
  132. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.d.ts +14 -0
  133. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +41 -0
  134. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
  135. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +29 -0
  136. package/project/plugins/package-version-plugins/package.d.ts +15 -0
  137. package/project/plugins/package-version-plugins/package.js +56 -0
  138. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.d.ts +15 -0
  139. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +44 -0
  140. package/queries/base-query-format.d.ts +2 -8
  141. package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
  142. package/queries/catalog/call-context-query/call-context-query-executor.js +21 -13
  143. package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -3
  144. package/queries/catalog/call-context-query/call-context-query-format.js +2 -2
  145. package/queries/catalog/cluster-query/cluster-query-executor.d.ts +1 -1
  146. package/queries/catalog/cluster-query/cluster-query-executor.js +2 -2
  147. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -54
  148. package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
  149. package/queries/catalog/config-query/config-query-executor.d.ts +1 -1
  150. package/queries/catalog/config-query/config-query-executor.js +5 -5
  151. package/queries/catalog/config-query/config-query-format.d.ts +1 -1
  152. package/queries/catalog/config-query/config-query-format.js +1 -1
  153. package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +1 -1
  154. package/queries/catalog/control-flow-query/control-flow-query-executor.js +3 -3
  155. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -54
  156. package/queries/catalog/control-flow-query/control-flow-query-format.js +2 -2
  157. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.d.ts +1 -1
  158. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +2 -2
  159. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -54
  160. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -1
  161. package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +1 -1
  162. package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -2
  163. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -54
  164. package/queries/catalog/dataflow-query/dataflow-query-format.js +1 -1
  165. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +1 -1
  166. package/queries/catalog/dependencies-query/dependencies-query-executor.js +19 -12
  167. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +7 -56
  168. package/queries/catalog/dependencies-query/dependencies-query-format.js +7 -4
  169. package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +1 -1
  170. package/queries/catalog/df-shape-query/df-shape-query-executor.js +4 -4
  171. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +1 -54
  172. package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
  173. package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
  174. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -1
  175. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -54
  176. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -1
  177. package/queries/catalog/id-map-query/id-map-query-executor.d.ts +1 -1
  178. package/queries/catalog/id-map-query/id-map-query-executor.js +2 -2
  179. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -54
  180. package/queries/catalog/id-map-query/id-map-query-format.js +2 -2
  181. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +3 -0
  182. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +45 -0
  183. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +22 -0
  184. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +32 -0
  185. package/queries/catalog/lineage-query/lineage-query-executor.d.ts +1 -1
  186. package/queries/catalog/lineage-query/lineage-query-executor.js +2 -2
  187. package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -54
  188. package/queries/catalog/lineage-query/lineage-query-format.js +1 -1
  189. package/queries/catalog/linter-query/linter-query-executor.d.ts +1 -1
  190. package/queries/catalog/linter-query/linter-query-executor.js +2 -3
  191. package/queries/catalog/linter-query/linter-query-format.d.ts +1 -54
  192. package/queries/catalog/linter-query/linter-query-format.js +1 -1
  193. package/queries/catalog/location-map-query/location-map-query-executor.d.ts +1 -1
  194. package/queries/catalog/location-map-query/location-map-query-executor.js +3 -2
  195. package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
  196. package/queries/catalog/location-map-query/location-map-query-format.js +1 -1
  197. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +1 -1
  198. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +2 -2
  199. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -54
  200. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -1
  201. package/queries/catalog/origin-query/origin-query-executor.d.ts +2 -2
  202. package/queries/catalog/origin-query/origin-query-executor.js +3 -3
  203. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -54
  204. package/queries/catalog/origin-query/origin-query-format.js +1 -1
  205. package/queries/catalog/project-query/project-query-executor.d.ts +1 -1
  206. package/queries/catalog/project-query/project-query-executor.js +2 -2
  207. package/queries/catalog/project-query/project-query-format.d.ts +1 -54
  208. package/queries/catalog/project-query/project-query-format.js +1 -1
  209. package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +1 -1
  210. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +4 -2
  211. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -54
  212. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
  213. package/queries/catalog/search-query/search-query-executor.d.ts +1 -1
  214. package/queries/catalog/search-query/search-query-executor.js +3 -3
  215. package/queries/catalog/search-query/search-query-format.d.ts +1 -54
  216. package/queries/catalog/search-query/search-query-format.js +1 -1
  217. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
  218. package/queries/catalog/static-slice-query/static-slice-query-executor.js +3 -3
  219. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -54
  220. package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -1
  221. package/queries/query-print.d.ts +4 -4
  222. package/queries/query-print.js +12 -12
  223. package/queries/query.d.ts +37 -885
  224. package/queries/query.js +3 -1
  225. package/r-bridge/parser.d.ts +7 -0
  226. package/r-bridge/retriever.d.ts +6 -5
  227. package/r-bridge/retriever.js +9 -5
  228. package/search/flowr-search-executor.d.ts +3 -5
  229. package/search/flowr-search-executor.js +6 -4
  230. package/search/flowr-search-filters.d.ts +12 -6
  231. package/search/flowr-search-filters.js +1 -1
  232. package/search/flowr-search.d.ts +5 -16
  233. package/search/flowr-search.js +14 -5
  234. package/search/search-executor/search-enrichers.d.ts +37 -36
  235. package/search/search-executor/search-enrichers.js +5 -4
  236. package/search/search-executor/search-generators.d.ts +12 -12
  237. package/search/search-executor/search-generators.js +27 -19
  238. package/search/search-executor/search-mappers.d.ts +5 -5
  239. package/search/search-executor/search-transformer.d.ts +17 -17
  240. package/search/search-executor/search-transformer.js +14 -7
  241. package/util/collections/arrays.d.ts +1 -0
  242. package/util/collections/arrays.js +15 -0
  243. package/util/collections/objectmap.d.ts +17 -0
  244. package/util/collections/objectmap.js +28 -0
  245. package/util/containers.d.ts +0 -1
  246. package/util/containers.js +0 -1
  247. package/util/files.d.ts +17 -0
  248. package/util/files.js +65 -0
  249. package/util/formats/adapter.d.ts +4 -2
  250. package/util/formats/adapter.js +11 -4
  251. package/util/r-value.d.ts +1 -1
  252. package/util/r-value.js +2 -0
  253. package/util/version.d.ts +17 -0
  254. package/util/version.js +28 -1
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.versionReplString = versionReplString;
4
4
  exports.printVersionRepl = printVersionRepl;
5
- const repl_version_1 = require("./commands/repl-version");
5
+ const version_1 = require("../../util/version");
6
6
  async function versionReplString(parser) {
7
- const version = await (0, repl_version_1.retrieveVersionInformation)(parser);
7
+ const version = await (0, version_1.retrieveVersionInformation)(parser);
8
8
  const rVersion = version.r === 'none' ? '' : version.r === 'unknown' ? ', R version unknown' : `, R v${version.r}`;
9
9
  const treeSitterVer = parser.name === 'tree-sitter' ? `, R grammar v${parser.treeSitterVersion()}` : '';
10
10
  return `flowR repl using flowR v${version.flowr}${rVersion}${treeSitterVer} (${version.engine} engine)`;
@@ -1,9 +1,13 @@
1
1
  import type { Socket } from './net';
2
+ import type { TREE_SITTER_DATAFLOW_PIPELINE } from '../../../core/steps/pipeline/default-pipelines';
2
3
  import { DEFAULT_SLICING_PIPELINE } from '../../../core/steps/pipeline/default-pipelines';
3
4
  import type { PipelineOutput } from '../../../core/steps/pipeline/pipeline';
4
5
  import type { DeepPartial } from 'ts-essentials';
5
- import type { KnownParser } from '../../../r-bridge/parser';
6
+ import type { KnownParser, ParseStepOutput } from '../../../r-bridge/parser';
6
7
  import type { FlowrConfigOptions } from '../../../config';
8
+ import type { NormalizedAst } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
9
+ import type { DataflowInformation } from '../../../dataflow/info';
10
+ import type { Tree } from 'web-tree-sitter';
7
11
  /**
8
12
  * Each connection handles a single client, answering to its requests.
9
13
  * There is no need to construct this class manually, {@link FlowRServer} will do it for you.
@@ -21,10 +25,10 @@ export declare class FlowRServerConnection {
21
25
  private handleData;
22
26
  private handleFileAnalysisRequest;
23
27
  private sendFileAnalysisResponse;
24
- private createPipelineExecutorForRequest;
28
+ private createAnalyzerForRequest;
25
29
  private handleSliceRequest;
26
30
  private handleRepl;
27
31
  private handleLineageRequest;
28
32
  private handleQueryRequest;
29
33
  }
30
- export declare function sanitizeAnalysisResults(results: Partial<PipelineOutput<typeof DEFAULT_SLICING_PIPELINE>>): DeepPartial<PipelineOutput<typeof DEFAULT_SLICING_PIPELINE>>;
34
+ export declare function sanitizeAnalysisResults(parse: ParseStepOutput<string | Tree>, normalize: NormalizedAst, dataflow: DataflowInformation): DeepPartial<PipelineOutput<typeof DEFAULT_SLICING_PIPELINE | typeof TREE_SITTER_DATAFLOW_PIPELINE>>;
@@ -48,20 +48,20 @@ const core_1 = require("../core");
48
48
  const extract_cfg_1 = require("../../../control-flow/extract-cfg");
49
49
  const quads_1 = require("../../../util/quads");
50
50
  const print_1 = require("../../../core/print/print");
51
+ const _00_parse_1 = require("../../../core/steps/all/core/00-parse");
52
+ const _10_normalize_1 = require("../../../core/steps/all/core/10-normalize");
53
+ const _20_dataflow_1 = require("../../../core/steps/all/core/20-dataflow");
51
54
  const ansi_1 = require("../../../util/text/ansi");
52
55
  const default_pipelines_1 = require("../../../core/steps/pipeline/default-pipelines");
53
56
  const graph_1 = require("../../../dataflow/graph/graph");
54
57
  const tmp = __importStar(require("tmp"));
55
58
  const fs_1 = __importDefault(require("fs"));
56
- const magic_comments_1 = require("../../../reconstruct/auto-select/magic-comments");
57
59
  const message_lineage_1 = require("./messages/message-lineage");
58
60
  const repl_lineage_1 = require("../commands/repl-lineage");
59
- const assert_1 = require("../../../util/assert");
60
- const auto_select_defaults_1 = require("../../../reconstruct/auto-select/auto-select-defaults");
61
61
  const message_query_1 = require("./messages/message-query");
62
- const query_1 = require("../../../queries/query");
63
62
  const compact_1 = require("./compact");
64
63
  const _00_slice_1 = require("../../../core/steps/all/static-slicing/00-slice");
64
+ const flowr_analyzer_builder_1 = require("../../../project/flowr-analyzer-builder");
65
65
  /**
66
66
  * Each connection handles a single client, answering to its requests.
67
67
  * There is no need to construct this class manually, {@link FlowRServer} will do it for you.
@@ -117,7 +117,7 @@ class FlowRServerConnection {
117
117
  this.handleRepl(request.message);
118
118
  break;
119
119
  case 'request-lineage':
120
- this.handleLineageRequest(request.message);
120
+ void this.handleLineageRequest(request.message);
121
121
  break;
122
122
  case 'request-query':
123
123
  this.handleQueryRequest(request.message);
@@ -146,9 +146,11 @@ class FlowRServerConnection {
146
146
  this.fileMap.delete(message.filetoken);
147
147
  }
148
148
  const tempFile = tmp.fileSync({ postfix: '.R' });
149
- const slicer = this.createPipelineExecutorForRequest(message, tempFile.name);
150
- await slicer.allRemainingSteps(false).then(async (results) => await this.sendFileAnalysisResponse(slicer, results, message))
151
- .catch(e => {
149
+ const analyzer = await this.createAnalyzerForRequest(message, tempFile.name);
150
+ try {
151
+ await this.sendFileAnalysisResponse(analyzer, message);
152
+ }
153
+ catch (e) {
152
154
  this.logger.error(`[${this.name}] Error while analyzing file ${message.filename ?? 'unknown file'}: ${String(e)}`);
153
155
  (0, send_1.sendMessage)(this.socket, {
154
156
  id: message.id,
@@ -156,22 +158,17 @@ class FlowRServerConnection {
156
158
  fatal: false,
157
159
  reason: `Error while analyzing file ${message.filename ?? 'unknown file'}: ${String(e)}`
158
160
  });
159
- });
161
+ }
160
162
  // this is an interestingly named function that means "I am a callback that removes a file" - so this deletes the file
161
163
  tempFile.removeCallback();
162
164
  }
163
- async sendFileAnalysisResponse(slicer, results, message) {
165
+ async sendFileAnalysisResponse(analyzer, message) {
164
166
  let cfg = undefined;
165
167
  if (message.cfg) {
166
- cfg = (0, extract_cfg_1.extractCfg)(results.normalize, this.config, results.dataflow?.graph);
168
+ cfg = await analyzer.controlflow();
167
169
  }
168
170
  const config = () => ({ context: message.filename ?? 'unknown', getId: (0, quads_1.defaultQuadIdGenerator)() });
169
- const sanitizedResults = sanitizeAnalysisResults(results);
170
- const pipeline = slicer.getPipeline();
171
- const parseStep = pipeline.steps.get('parse');
172
- const normalizedStep = pipeline.steps.get('normalize');
173
- const dataflowStep = pipeline.steps.get('dataflow');
174
- (0, assert_1.guard)(parseStep !== undefined && normalizedStep !== undefined && dataflowStep !== undefined, 'All steps must be present');
171
+ const sanitizedResults = sanitizeAnalysisResults(await analyzer.parse(), await analyzer.normalize(), await analyzer.dataflow());
175
172
  if (message.format === 'n-quads') {
176
173
  (0, send_1.sendMessage)(this.socket, {
177
174
  type: 'response-file-analysis',
@@ -179,9 +176,9 @@ class FlowRServerConnection {
179
176
  id: message.id,
180
177
  cfg: cfg ? (0, extract_cfg_1.cfg2quads)(cfg, config()) : undefined,
181
178
  results: {
182
- parse: await (0, print_1.printStepResult)(parseStep, sanitizedResults.parse, 5 /* StepOutputFormat.RdfQuads */, config()),
183
- normalize: await (0, print_1.printStepResult)(normalizedStep, sanitizedResults.normalize, 5 /* StepOutputFormat.RdfQuads */, config()),
184
- dataflow: await (0, print_1.printStepResult)(dataflowStep, sanitizedResults.dataflow, 5 /* StepOutputFormat.RdfQuads */, config())
179
+ parse: await (0, print_1.printStepResult)(_00_parse_1.PARSE_WITH_R_SHELL_STEP, await analyzer.parse(), 5 /* StepOutputFormat.RdfQuads */, config()),
180
+ normalize: await (0, print_1.printStepResult)(_10_normalize_1.NORMALIZE, await analyzer.normalize(), 5 /* StepOutputFormat.RdfQuads */, config()),
181
+ dataflow: await (0, print_1.printStepResult)(_20_dataflow_1.STATIC_DATAFLOW, await analyzer.dataflow(), 5 /* StepOutputFormat.RdfQuads */, config())
185
182
  }
186
183
  });
187
184
  }
@@ -204,7 +201,7 @@ class FlowRServerConnection {
204
201
  });
205
202
  }
206
203
  }
207
- createPipelineExecutorForRequest(message, tempFile) {
204
+ async createAnalyzerForRequest(message, tempFile) {
208
205
  let request;
209
206
  if (message.content !== undefined) {
210
207
  // we store the code in a temporary file in case it's too big for the shell to handle
@@ -222,18 +219,18 @@ class FlowRServerConnection {
222
219
  else {
223
220
  throw new Error('Either content or filepath must be defined.');
224
221
  }
225
- const slicer = (0, default_pipelines_1.createSlicePipeline)(this.parser, {
226
- request,
227
- criterion: [] // currently unknown
228
- }, this.config);
222
+ const analyzer = await new flowr_analyzer_builder_1.FlowrAnalyzerBuilder(request)
223
+ .setConfig(this.config)
224
+ .setParser(this.parser)
225
+ .build();
229
226
  if (message.filetoken) {
230
227
  this.logger.info(`Storing file token ${message.filetoken}`);
231
228
  this.fileMap.set(message.filetoken, {
232
229
  filename: message.filename,
233
- pipeline: slicer
230
+ analyzer: analyzer
234
231
  });
235
232
  }
236
- return slicer;
233
+ return analyzer;
237
234
  }
238
235
  handleSliceRequest(base) {
239
236
  const requestResult = (0, validate_1.validateMessage)(base, message_slice_1.requestSliceMessage);
@@ -253,16 +250,16 @@ class FlowRServerConnection {
253
250
  });
254
251
  return;
255
252
  }
256
- fileInformation.pipeline.updateRequest({
257
- criterion: request.criterion,
258
- direction: request.direction,
259
- autoSelectIf: request.noMagicComments ? auto_select_defaults_1.doNotAutoSelect : (0, magic_comments_1.makeMagicCommentHandler)(auto_select_defaults_1.doNotAutoSelect)
260
- });
261
- void fileInformation.pipeline.allRemainingSteps(true).then(results => {
253
+ void fileInformation.analyzer.query([{
254
+ type: 'static-slice',
255
+ criteria: request.criterion,
256
+ noMagicComments: request.noMagicComments,
257
+ direction: request.direction
258
+ }]).then(result => {
262
259
  (0, send_1.sendMessage)(this.socket, {
263
260
  type: 'response-slice',
264
261
  id: request.id,
265
- results: Object.fromEntries(Object.entries(results)
262
+ results: Object.fromEntries(Object.entries(result)
266
263
  .filter(([k,]) => default_pipelines_1.DEFAULT_SLICING_PIPELINE.steps.get(k)?.executed === 1 /* PipelineStepStage.OncePerRequest */))
267
264
  });
268
265
  }).catch(e => {
@@ -290,18 +287,22 @@ class FlowRServerConnection {
290
287
  stream
291
288
  });
292
289
  };
293
- void (0, core_1.replProcessAnswer)(this.config, {
290
+ const analyzer = new flowr_analyzer_builder_1.FlowrAnalyzerBuilder()
291
+ .setConfig(this.config)
292
+ .setParser(this.parser)
293
+ .buildSync();
294
+ void (0, core_1.replProcessAnswer)(analyzer, {
294
295
  formatter: request.ansi ? ansi_1.ansiFormatter : ansi_1.voidFormatter,
295
296
  stdout: msg => out('stdout', msg),
296
297
  stderr: msg => out('stderr', msg)
297
- }, request.expression, this.parser, this.allowRSessionAccess).then(() => {
298
+ }, request.expression, this.allowRSessionAccess).then(() => {
298
299
  (0, send_1.sendMessage)(this.socket, {
299
300
  type: 'end-repl-execution',
300
301
  id: request.id
301
302
  });
302
303
  });
303
304
  }
304
- handleLineageRequest(base) {
305
+ async handleLineageRequest(base) {
305
306
  const requestResult = (0, validate_1.validateMessage)(base, message_lineage_1.requestLineageMessage);
306
307
  if (requestResult.type === 'error') {
307
308
  (0, validate_1.answerForValidationError)(this.socket, requestResult, base.id);
@@ -319,10 +320,8 @@ class FlowRServerConnection {
319
320
  });
320
321
  return;
321
322
  }
322
- const { dataflow: dfg, normalize: ast } = fileInformation.pipeline.getResults(true);
323
- (0, assert_1.guard)(dfg !== undefined, `Dataflow graph must be present (request: ${request.filetoken})`);
324
- (0, assert_1.guard)(ast !== undefined, `AST must be present (request: ${request.filetoken})`);
325
- const lineageIds = (0, repl_lineage_1.getLineage)(request.criterion, dfg.graph, ast.idMap);
323
+ const analyzer = fileInformation.analyzer;
324
+ const lineageIds = (0, repl_lineage_1.getLineage)(request.criterion, (await analyzer.dataflow()).graph, (await analyzer.normalize()).idMap);
326
325
  (0, send_1.sendMessage)(this.socket, {
327
326
  type: 'response-lineage',
328
327
  id: request.id,
@@ -347,10 +346,7 @@ class FlowRServerConnection {
347
346
  });
348
347
  return;
349
348
  }
350
- const { dataflow: dfg, normalize: ast } = fileInformation.pipeline.getResults(true);
351
- (0, assert_1.guard)(dfg !== undefined, `Dataflow graph must be present (request: ${request.filetoken})`);
352
- (0, assert_1.guard)(ast !== undefined, `AST must be present (request: ${request.filetoken})`);
353
- void Promise.resolve((0, query_1.executeQueries)({ dataflow: dfg, ast, config: this.config }, request.query)).then(results => {
349
+ void Promise.resolve(fileInformation.analyzer.query(request.query)).then(results => {
354
350
  (0, send_1.sendMessage)(this.socket, {
355
351
  type: 'response-query',
356
352
  id: request.id,
@@ -368,17 +364,17 @@ class FlowRServerConnection {
368
364
  }
369
365
  }
370
366
  exports.FlowRServerConnection = FlowRServerConnection;
371
- function sanitizeAnalysisResults(results) {
367
+ function sanitizeAnalysisResults(parse, normalize, dataflow) {
372
368
  return {
373
- ...results,
369
+ parse: parse,
374
370
  normalize: {
375
- ...results.normalize,
371
+ ...normalize,
376
372
  idMap: undefined
377
373
  },
378
374
  dataflow: {
379
- ...results.dataflow,
375
+ ...dataflow,
380
376
  // we want to keep the DataflowGraph type information, but not the idMap
381
- graph: new graph_1.DataflowGraph(undefined).mergeWith(results.dataflow?.graph)
377
+ graph: new graph_1.DataflowGraph(undefined).mergeWith(dataflow?.graph)
382
378
  }
383
379
  };
384
380
  }
@@ -1,5 +1,5 @@
1
- import type { VersionInformation } from '../../commands/repl-version';
2
1
  import type { IdMessageBase, MessageDefinition } from './all-messages';
2
+ import type { VersionInformation } from '../../../../util/version';
3
3
  /**
4
4
  * The hello message is automatically sent by the sever upon connection.
5
5
  */
@@ -17,7 +17,7 @@ export interface SliceRequestMessage extends IdMessageBase {
17
17
  /** The direction to slice in. Defaults to backward slicing if unset. */
18
18
  direction?: SliceDirection;
19
19
  /**
20
- * Should the magic comments (force-including lines within the slice) be ignord?
20
+ * Should the magic comments (force-including lines within the slice) be ignored?
21
21
  */
22
22
  noMagicComments?: boolean;
23
23
  }
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FlowRServer = exports.serverLog = void 0;
4
- const repl_version_1 = require("../commands/repl-version");
5
4
  const connection_1 = require("./connection");
6
5
  const send_1 = require("./send");
7
6
  const net_1 = require("./net");
8
7
  const log_1 = require("../../../util/log");
8
+ const version_1 = require("../../../util/version");
9
9
  // we detach from the main logger so that it can have its own switch
10
10
  exports.serverLog = new log_1.FlowrLogger({ name: 'server' });
11
11
  /**
@@ -32,7 +32,7 @@ class FlowRServer {
32
32
  this.config = config;
33
33
  }
34
34
  async start(port) {
35
- this.versionInformation = await (0, repl_version_1.retrieveVersionInformation)(this.engines[this.defaultEngine]);
35
+ this.versionInformation = await (0, version_1.retrieveVersionInformation)(this.engines[this.defaultEngine]);
36
36
  this.server.start(port);
37
37
  exports.serverLog.info(`Server listening on port ${port}`);
38
38
  }
package/cli/slicer-app.js CHANGED
@@ -32,7 +32,7 @@ async function getSlice() {
32
32
  (0, assert_1.guard)(options.criterion !== undefined, 'a slicing criterion must be given');
33
33
  const config = (0, config_1.getConfig)();
34
34
  await slicer.init(options['input-is-text']
35
- ? { request: 'text', content: options.input.replaceAll('\\n', '\n') }
35
+ ? (0, adapter_1.requestFromText)(options.input.replaceAll('\\n', '\n'))
36
36
  : (0, adapter_1.requestFromFile)(options.input), config, options['no-magic-comments'] ? auto_select_defaults_1.doNotAutoSelect : (0, magic_comments_1.makeMagicCommentHandler)(auto_select_defaults_1.doNotAutoSelect));
37
37
  let mappedSlices = [];
38
38
  let reconstruct = undefined;
package/config.d.ts CHANGED
@@ -209,7 +209,7 @@ export declare function parseConfig(jsonString: string): FlowrConfigOptions | un
209
209
  /**
210
210
  * Creates a new flowr config that has the updated values.
211
211
  */
212
- export declare function amendConfig(config: FlowrConfigOptions, amendmentFunc: (config: DeepWritable<FlowrConfigOptions>) => FlowrConfigOptions): FlowrConfigOptions;
212
+ export declare function amendConfig(config: FlowrConfigOptions, amendmentFunc: (config: DeepWritable<FlowrConfigOptions>) => FlowrConfigOptions | void): FlowrConfigOptions;
213
213
  export declare function cloneConfig(config: FlowrConfigOptions): FlowrConfigOptions;
214
214
  export declare function getConfig(configFile?: string, configWorkingDirectory?: string): FlowrConfigOptions;
215
215
  export declare function getEngineConfig<T extends EngineConfig['type']>(config: FlowrConfigOptions, engine: T): EngineConfig & {
package/config.js CHANGED
@@ -162,8 +162,11 @@ function parseConfig(jsonString) {
162
162
  /**
163
163
  * Creates a new flowr config that has the updated values.
164
164
  */
165
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
165
166
  function amendConfig(config, amendmentFunc) {
166
- return amendmentFunc(cloneConfig(config));
167
+ const newConfig = cloneConfig(config);
168
+ amendmentFunc(newConfig);
169
+ return newConfig;
167
170
  }
168
171
  function cloneConfig(config) {
169
172
  return JSON.parse(JSON.stringify(config));
@@ -18,7 +18,7 @@ import type { FlowrConfigOptions } from '../config';
18
18
  */
19
19
  export declare function extractCfg<Info = ParentInformation>(ast: NormalizedAst<Info & ParentInformation>, config: FlowrConfigOptions, graph?: DataflowGraph, simplifications?: readonly CfgSimplificationPassName[]): ControlFlowInformation;
20
20
  /**
21
- * A version of {@link extractCfg} that is much quicker and does not apply any simplifciations or dataflow information.
21
+ * A version of {@link extractCfg} that is much quicker and does not apply any simplifications or dataflow information.
22
22
  */
23
23
  export declare function extractCfgQuick<Info = ParentInformation>(ast: NormalizedAst<Info>): ControlFlowInformation<import("./control-flow-graph").CfgSimpleVertex>;
24
24
  export declare const ResolvedCallSuffix = "-resolved-call-exit";
@@ -67,7 +67,7 @@ function extractCfg(ast, config, graph, simplifications) {
67
67
  return (0, cfg_simplification_1.simplifyControlFlowInformation)((0, fold_1.foldAst)(ast.ast, graph ? dataflowCfgFolds(graph) : cfgFolds), { ast, dfg: graph, config }, simplifications);
68
68
  }
69
69
  /**
70
- * A version of {@link extractCfg} that is much quicker and does not apply any simplifciations or dataflow information.
70
+ * A version of {@link extractCfg} that is much quicker and does not apply any simplifications or dataflow information.
71
71
  */
72
72
  function extractCfgQuick(ast) {
73
73
  return (0, fold_1.foldAst)(ast.ast, cfgFolds);
@@ -3,6 +3,10 @@ import { PipelineStepStage } from './steps/pipeline-step';
3
3
  import type { Pipeline, PipelineInput, PipelineOutput, PipelinePerRequestInput, PipelineStepOutputWithName } from './steps/pipeline/pipeline';
4
4
  import type { FlowrConfigOptions } from '../config';
5
5
  /**
6
+ * **Please note:** The {@link PipelineExecutor} is now considered to be a rather low-level API for flowR. While it still works
7
+ * and is the basis for all other layers, we strongly recommend using the {@link FlowrAnalyzer} and its {@link FlowrAnalyzerBuilder|builder}
8
+ * to create and use an analyzer instance that is pre-configured for your use-case.
9
+ *
6
10
  * The pipeline executor allows to execute arbitrary {@link Pipeline|pipelines} in a step-by-step fashion.
7
11
  * If you are not yet in the possession of a {@link Pipeline|pipeline}, you can use the {@link createPipeline} function
8
12
  * to create one for yourself, based on the steps that you want to execute.
@@ -98,6 +102,7 @@ export declare class PipelineExecutor<P extends Pipeline> {
98
102
  * The required additional input is specified by the {@link IPipelineStep#requiredInput|required input configuration} of each step in the `pipeline`.
99
103
  *
100
104
  * Please see {@link createDataflowPipeline} and friends for engine agnostic shortcuts to create a pipeline executor.
105
+ * And in general, please prefer using the {@link FlowrAnalyzer} and its {@link FlowrAnalyzerBuilder|builder} to create and use an analyzer instance.
101
106
  *
102
107
  * @param pipeline - The {@link Pipeline} to execute, probably created with {@link createPipeline}.
103
108
  * @param input - External {@link PipelineInput|configuration and input} required to execute the given pipeline.
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PipelineExecutor = void 0;
4
4
  const assert_1 = require("../util/assert");
5
5
  /**
6
+ * **Please note:** The {@link PipelineExecutor} is now considered to be a rather low-level API for flowR. While it still works
7
+ * and is the basis for all other layers, we strongly recommend using the {@link FlowrAnalyzer} and its {@link FlowrAnalyzerBuilder|builder}
8
+ * to create and use an analyzer instance that is pre-configured for your use-case.
9
+ *
6
10
  * The pipeline executor allows to execute arbitrary {@link Pipeline|pipelines} in a step-by-step fashion.
7
11
  * If you are not yet in the possession of a {@link Pipeline|pipeline}, you can use the {@link createPipeline} function
8
12
  * to create one for yourself, based on the steps that you want to execute.
@@ -98,6 +102,7 @@ class PipelineExecutor {
98
102
  * The required additional input is specified by the {@link IPipelineStep#requiredInput|required input configuration} of each step in the `pipeline`.
99
103
  *
100
104
  * Please see {@link createDataflowPipeline} and friends for engine agnostic shortcuts to create a pipeline executor.
105
+ * And in general, please prefer using the {@link FlowrAnalyzer} and its {@link FlowrAnalyzerBuilder|builder} to create and use an analyzer instance.
101
106
  *
102
107
  * @param pipeline - The {@link Pipeline} to execute, probably created with {@link createPipeline}.
103
108
  * @param input - External {@link PipelineInput|configuration and input} required to execute the given pipeline.
@@ -10,7 +10,9 @@ declare function processor(results: {
10
10
  }, input: {
11
11
  request?: RParseRequests;
12
12
  parser?: Parser<KnownParserType>;
13
- }, config: FlowrConfigOptions): import("../../../../dataflow/info").DataflowInformation;
13
+ }, config: FlowrConfigOptions): import("../../../../dataflow/info").DataflowInformation & {
14
+ cfgQuick: import("../../../../control-flow/control-flow-graph").ControlFlowInformation | undefined;
15
+ };
14
16
  export declare const STATIC_DATAFLOW: {
15
17
  readonly humanReadableName: "dataflow";
16
18
  readonly processor: typeof processor;
@@ -27,7 +27,7 @@ function verifyAndBuildPipeline(steps) {
27
27
  // now, we do the same for the per-request steps, keeping the per-file steps known
28
28
  initializeSteps(perRequestSteps, perRequestStepMap, initsPerRequest, visited);
29
29
  const sortedPerRequest = topologicalSort(initsPerRequest, perRequestStepMap, visited);
30
- const sorted = [...sortedPerFile, ...sortedPerRequest];
30
+ const sorted = sortedPerFile.concat(sortedPerRequest);
31
31
  validateStepOutput(sorted, perRequestStepMap, steps);
32
32
  return {
33
33
  steps: perRequestStepMap,
@@ -61,7 +61,9 @@ export declare const DEFAULT_SLICING_PIPELINE: import("./pipeline").Pipeline<{
61
61
  }, input: {
62
62
  request?: import("../../../r-bridge/retriever").RParseRequests;
63
63
  parser?: Parser<import("../../../r-bridge/parser").KnownParserType>;
64
- }, config: FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
64
+ }, config: FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation & {
65
+ cfgQuick: import("../../../control-flow/control-flow-graph").ControlFlowInformation | undefined;
66
+ };
65
67
  readonly requiredInput: {};
66
68
  readonly name: "dataflow";
67
69
  readonly description: "Construct the dataflow graph";
@@ -143,7 +145,9 @@ export declare const DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipeline"
143
145
  }, input: {
144
146
  request?: import("../../../r-bridge/retriever").RParseRequests;
145
147
  parser?: Parser<import("../../../r-bridge/parser").KnownParserType>;
146
- }, config: FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
148
+ }, config: FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation & {
149
+ cfgQuick: import("../../../control-flow/control-flow-graph").ControlFlowInformation | undefined;
150
+ };
147
151
  readonly requiredInput: {};
148
152
  readonly name: "dataflow";
149
153
  readonly description: "Construct the dataflow graph";
@@ -225,7 +229,9 @@ export declare const DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./pipel
225
229
  }, input: {
226
230
  request?: import("../../../r-bridge/retriever").RParseRequests;
227
231
  parser?: Parser<import("../../../r-bridge/parser").KnownParserType>;
228
- }, config: FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
232
+ }, config: FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation & {
233
+ cfgQuick: import("../../../control-flow/control-flow-graph").ControlFlowInformation | undefined;
234
+ };
229
235
  readonly requiredInput: {};
230
236
  readonly name: "dataflow";
231
237
  readonly description: "Construct the dataflow graph";
@@ -260,7 +266,9 @@ export declare const TREE_SITTER_SLICING_PIPELINE: import("./pipeline").Pipeline
260
266
  }, input: {
261
267
  request?: import("../../../r-bridge/retriever").RParseRequests;
262
268
  parser?: Parser<import("../../../r-bridge/parser").KnownParserType>;
263
- }, config: FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
269
+ }, config: FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation & {
270
+ cfgQuick: import("../../../control-flow/control-flow-graph").ControlFlowInformation | undefined;
271
+ };
264
272
  readonly requiredInput: {};
265
273
  readonly name: "dataflow";
266
274
  readonly description: "Construct the dataflow graph";
@@ -341,7 +349,9 @@ export declare const TREE_SITTER_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipel
341
349
  }, input: {
342
350
  request?: import("../../../r-bridge/retriever").RParseRequests;
343
351
  parser?: Parser<import("../../../r-bridge/parser").KnownParserType>;
344
- }, config: FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
352
+ }, config: FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation & {
353
+ cfgQuick: import("../../../control-flow/control-flow-graph").ControlFlowInformation | undefined;
354
+ };
345
355
  readonly requiredInput: {};
346
356
  readonly name: "dataflow";
347
357
  readonly description: "Construct the dataflow graph";
@@ -422,7 +432,9 @@ export declare const TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./p
422
432
  }, input: {
423
433
  request?: import("../../../r-bridge/retriever").RParseRequests;
424
434
  parser?: Parser<import("../../../r-bridge/parser").KnownParserType>;
425
- }, config: FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
435
+ }, config: FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation & {
436
+ cfgQuick: import("../../../control-flow/control-flow-graph").ControlFlowInformation | undefined;
437
+ };
426
438
  readonly requiredInput: {};
427
439
  readonly name: "dataflow";
428
440
  readonly description: "Construct the dataflow graph";
@@ -513,7 +525,9 @@ export declare const DEFAULT_DATAFLOW_PIPELINE: import("./pipeline").Pipeline<{
513
525
  }, input: {
514
526
  request?: import("../../../r-bridge/retriever").RParseRequests;
515
527
  parser?: Parser<import("../../../r-bridge/parser").KnownParserType>;
516
- }, config: FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
528
+ }, config: FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation & {
529
+ cfgQuick: import("../../../control-flow/control-flow-graph").ControlFlowInformation | undefined;
530
+ };
517
531
  readonly requiredInput: {};
518
532
  readonly name: "dataflow";
519
533
  readonly description: "Construct the dataflow graph";
@@ -534,7 +548,9 @@ export declare const TREE_SITTER_DATAFLOW_PIPELINE: import("./pipeline").Pipelin
534
548
  }, input: {
535
549
  request?: import("../../../r-bridge/retriever").RParseRequests;
536
550
  parser?: Parser<import("../../../r-bridge/parser").KnownParserType>;
537
- }, config: FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation;
551
+ }, config: FlowrConfigOptions) => import("../../../dataflow/info").DataflowInformation & {
552
+ cfgQuick: import("../../../control-flow/control-flow-graph").ControlFlowInformation | undefined;
553
+ };
538
554
  readonly requiredInput: {};
539
555
  readonly name: "dataflow";
540
556
  readonly description: "Construct the dataflow graph";
@@ -33,6 +33,7 @@ exports.TREE_SITTER_NORMALIZE_PIPELINE = (0, pipeline_1.createPipeline)(_01_pars
33
33
  exports.DEFAULT_PARSE_PIPELINE = (0, pipeline_1.createPipeline)(_00_parse_1.PARSE_WITH_R_SHELL_STEP);
34
34
  exports.TREE_SITTER_PARSE_PIPELINE = (0, pipeline_1.createPipeline)(_01_parse_tree_sitter_1.PARSE_WITH_TREE_SITTER_STEP);
35
35
  /**
36
+ * **Please use {@link FlowrAnalyzer} instead of this directly unless you really know what you are doing.**
36
37
  * Returns either a {@link DEFAULT_PARSE_PIPELINE} or a {@link TREE_SITTER_PARSE_PIPELINE} depending on the parser used.
37
38
  *
38
39
  * @see {@link createNormalizePipeline}, {@link createDataflowPipeline}, {@link createSlicePipeline}
@@ -45,6 +46,7 @@ function createParsePipeline(parser, inputs, config) {
45
46
  }, config);
46
47
  }
47
48
  /**
49
+ * **Please use {@link FlowrAnalyzer} instead of this directly unless you really know what you are doing.**
48
50
  * Returns either a {@link DEFAULT_SLICING_PIPELINE} or a {@link TREE_SITTER_SLICING_PIPELINE} depending on the parser used.
49
51
  *
50
52
  * @see {@link createParsePipeline}, {@link createNormalizePipeline}, {@link createDataflowPipeline}
@@ -57,6 +59,7 @@ function createSlicePipeline(parser, inputs, config) {
57
59
  }, config);
58
60
  }
59
61
  /**
62
+ * **Please use {@link FlowrAnalyzer} instead of this directly unless you really know what you are doing.**
60
63
  * Returns either a {@link DEFAULT_NORMALIZE_PIPELINE} or a {@link TREE_SITTER_NORMALIZE_PIPELINE} depending on the parser used.
61
64
  *
62
65
  * @see {@link createParsePipeline}, {@link createDataflowPipeline}, {@link createSlicePipeline}
@@ -69,10 +72,10 @@ function createNormalizePipeline(parser, inputs, config) {
69
72
  }, config);
70
73
  }
71
74
  /**
75
+ * **Please use {@link FlowrAnalyzer} instead of this directly unless you really know what you are doing.**
72
76
  * Returns either a {@link DEFAULT_DATAFLOW_PIPELINE} or a {@link TREE_SITTER_DATAFLOW_PIPELINE} depending on the parser used.
73
77
  *
74
78
  * @see {@link createParsePipeline}, {@link createNormalizePipeline}, {@link createSlicePipeline}
75
- *
76
79
  */
77
80
  function createDataflowPipeline(parser, inputs, config) {
78
81
  const base = parser.name === 'tree-sitter' ? exports.TREE_SITTER_DATAFLOW_PIPELINE : exports.DEFAULT_DATAFLOW_PIPELINE;
@@ -212,6 +212,14 @@ exports.DefaultBuiltinConfig = [
212
212
  { type: 'function', names: ['('], processor: 'builtin:default', config: { returnsNthArgument: 0 }, assumePrimitive: true },
213
213
  { type: 'function', names: ['load', 'load_all', 'setwd', 'set.seed'], processor: 'builtin:default', config: { hasUnknownSideEffects: true, forceArgs: [true] }, assumePrimitive: false },
214
214
  { type: 'function', names: ['body', 'formals', 'environment'], processor: 'builtin:default', config: { hasUnknownSideEffects: true, forceArgs: [true] }, assumePrimitive: true },
215
+ { type: 'function', names: ['.Call', '.External', '.C', '.Fortran'], processor: 'builtin:default', config: { hasUnknownSideEffects: true, forceArgs: [true],
216
+ treatAsFnCall: {
217
+ '.Call': ['.NAME'],
218
+ '.External': ['.NAME'],
219
+ '.C': ['.NAME'],
220
+ '.Fortran': ['.NAME']
221
+ }
222
+ }, assumePrimitive: true },
215
223
  { type: 'function', names: ['eval'], processor: 'builtin:eval', config: { includeFunctionCall: true }, assumePrimitive: true },
216
224
  { type: 'function', names: ['cat'], processor: 'builtin:default', config: { forceArgs: 'all', hasUnknownSideEffects: { type: 'link-to-last-call', callName: /^sink$/ } }, assumePrimitive: false },
217
225
  { type: 'function', names: ['switch'], processor: 'builtin:default', config: { forceArgs: [true] }, assumePrimitive: false },
@@ -138,6 +138,8 @@ function resolveIdToValue(id, { environment, graph, idMap, full = true, resolve
138
138
  else {
139
139
  return r_value_1.Top;
140
140
  }
141
+ case type_1.RType.FunctionDefinition:
142
+ return (0, set_constants_1.setFrom)({ type: 'function-definition' });
141
143
  case type_1.RType.FunctionCall:
142
144
  case type_1.RType.BinaryOp:
143
145
  case type_1.RType.UnaryOp:
@@ -41,6 +41,9 @@ function resolveNode(resolve, a, env, graph, map) {
41
41
  else if (a.type === type_1.RType.Logical) {
42
42
  return a.content.valueOf() ? logical_constants_1.ValueLogicalTrue : logical_constants_1.ValueLogicalFalse;
43
43
  }
44
+ else if (a.type === type_1.RType.FunctionDefinition) {
45
+ return { type: 'function-definition' };
46
+ }
44
47
  else if ((a.type === type_1.RType.FunctionCall || a.type === type_1.RType.BinaryOp || a.type === type_1.RType.UnaryOp) && graph) {
45
48
  const origin = (0, dfg_get_origin_1.getOriginInDfg)(graph, a.info.id)?.[0];
46
49
  if (origin === undefined || origin.type !== 3 /* OriginType.BuiltInFunctionOrigin */) {
@@ -37,6 +37,9 @@ export interface ValueString<Str extends Lift<RStringValue> = Lift<RStringValue>
37
37
  type: 'string';
38
38
  value: Str;
39
39
  }
40
+ export interface ValueFunctionDefinition {
41
+ type: 'function-definition';
42
+ }
40
43
  export interface ValueMissing {
41
44
  type: 'missing';
42
45
  }
@@ -45,7 +48,7 @@ export interface ValueLogical {
45
48
  type: 'logical';
46
49
  value: Lift<TernaryLogical>;
47
50
  }
48
- export type Value = Lift<ValueInterval | ValueVector | ValueSet | ValueNumber | ValueString | ValueLogical | ValueMissing>;
51
+ export type Value = Lift<ValueInterval | ValueVector | ValueSet | ValueNumber | ValueString | ValueLogical | ValueMissing | ValueFunctionDefinition>;
49
52
  export type ValueType<V> = V extends {
50
53
  type: infer T;
51
54
  } ? T : never;
@@ -82,6 +82,8 @@ function stringifyValue(value) {
82
82
  return tryStringifyBoTop(v.value, l => l === 'maybe' ? 'maybe' : l ? 'TRUE' : 'FALSE', () => '⊤ (logical)', () => '⊥ (logical)');
83
83
  case 'missing':
84
84
  return '(missing)';
85
+ case 'function-definition':
86
+ return 'fn-def';
85
87
  default:
86
88
  (0, assert_1.assertUnreachable)(t);
87
89
  }
@@ -3,6 +3,7 @@ import type { DataflowProcessors } from './processor';
3
3
  import type { NormalizedAst, ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
4
4
  import type { RParseRequests } from '../r-bridge/retriever';
5
5
  import type { KnownParserType, Parser } from '../r-bridge/parser';
6
+ import type { ControlFlowInformation } from '../control-flow/control-flow-graph';
6
7
  import type { FlowrConfigOptions } from '../config';
7
8
  /**
8
9
  * The best friend of {@link produceDataFlowGraph} and {@link processDataflowFor}.
@@ -15,4 +16,6 @@ export declare const processors: DataflowProcessors<ParentInformation>;
15
16
  * (e.g., in the event of a `source` call).
16
17
  * For the actual, canonical fold entry point, see {@link processDataflowFor}.
17
18
  */
18
- export declare function produceDataFlowGraph<OtherInfo>(parser: Parser<KnownParserType>, request: RParseRequests, completeAst: NormalizedAst<OtherInfo & ParentInformation>, config: FlowrConfigOptions): DataflowInformation;
19
+ export declare function produceDataFlowGraph<OtherInfo>(parser: Parser<KnownParserType>, request: RParseRequests, completeAst: NormalizedAst<OtherInfo & ParentInformation>, config: FlowrConfigOptions): DataflowInformation & {
20
+ cfgQuick: ControlFlowInformation | undefined;
21
+ };