@eagleoutice/flowr 2.9.13 → 2.10.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 (237) hide show
  1. package/README.md +52 -28
  2. package/abstract-interpretation/absint-visitor.d.ts +1 -1
  3. package/abstract-interpretation/absint-visitor.js +20 -20
  4. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +2 -2
  5. package/benchmark/slicer.d.ts +1 -1
  6. package/benchmark/slicer.js +7 -5
  7. package/benchmark/stats/stats.d.ts +2 -2
  8. package/cli/repl/commands/repl-dataflow.js +5 -5
  9. package/cli/repl/parser/slice-query-parser.d.ts +3 -3
  10. package/cli/repl/parser/slice-query-parser.js +2 -2
  11. package/cli/repl/server/connection.js +2 -2
  12. package/cli/repl/server/messages/message-slice.d.ts +1 -1
  13. package/cli/repl/server/messages/message-slice.js +2 -2
  14. package/config.d.ts +12 -8
  15. package/config.js +5 -3
  16. package/control-flow/extract-cfg.js +2 -2
  17. package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
  18. package/control-flow/semantic-cfg-guided-visitor.js +43 -43
  19. package/control-flow/useless-loop.d.ts +1 -1
  20. package/control-flow/useless-loop.js +3 -3
  21. package/core/print/dataflow-printer.d.ts +0 -14
  22. package/core/print/dataflow-printer.js +0 -21
  23. package/core/steps/all/core/20-dataflow.d.ts +3 -3
  24. package/core/steps/all/core/20-dataflow.js +3 -2
  25. package/core/steps/all/static-slicing/00-slice.d.ts +2 -5
  26. package/core/steps/all/static-slicing/00-slice.js +6 -8
  27. package/core/steps/pipeline/default-pipelines.d.ts +89 -89
  28. package/dataflow/environments/built-in-proc-name.d.ts +83 -0
  29. package/dataflow/environments/built-in-proc-name.js +88 -0
  30. package/dataflow/environments/built-in.d.ts +1 -83
  31. package/dataflow/environments/built-in.js +37 -120
  32. package/dataflow/environments/default-builtin-config.d.ts +1 -1
  33. package/dataflow/environments/default-builtin-config.js +75 -75
  34. package/dataflow/environments/identifier.d.ts +5 -0
  35. package/dataflow/environments/identifier.js +18 -0
  36. package/dataflow/eval/resolve/resolve.js +2 -2
  37. package/dataflow/fn/exceptions-of-function.d.ts +1 -1
  38. package/dataflow/fn/exceptions-of-function.js +2 -2
  39. package/dataflow/graph/call-graph.d.ts +46 -19
  40. package/dataflow/graph/call-graph.js +95 -114
  41. package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
  42. package/dataflow/graph/dataflowgraph-builder.js +2 -2
  43. package/dataflow/graph/df-helper.d.ts +133 -0
  44. package/dataflow/graph/df-helper.js +138 -0
  45. package/dataflow/graph/diff-dataflow-graph.d.ts +5 -10
  46. package/dataflow/graph/diff-dataflow-graph.js +3 -28
  47. package/dataflow/graph/edge.d.ts +1 -0
  48. package/dataflow/graph/edge.js +1 -0
  49. package/dataflow/graph/graph-helper.d.ts +60 -0
  50. package/dataflow/graph/graph-helper.js +128 -0
  51. package/dataflow/graph/graph.d.ts +19 -3
  52. package/dataflow/graph/graph.js +32 -5
  53. package/dataflow/graph/vertex.d.ts +3 -1
  54. package/dataflow/info.d.ts +14 -4
  55. package/dataflow/info.js +28 -16
  56. package/dataflow/internal/linker.d.ts +14 -10
  57. package/dataflow/internal/linker.js +29 -32
  58. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +5 -5
  59. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +5 -4
  60. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +8 -7
  61. package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
  62. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +3 -3
  63. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +2 -2
  64. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +3 -3
  65. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +6 -6
  66. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +2 -2
  67. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +3 -3
  68. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +2 -2
  69. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
  70. package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +1 -1
  71. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -5
  72. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
  73. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +2 -2
  74. package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
  75. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +5 -5
  76. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -2
  77. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -1
  78. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -4
  79. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -2
  80. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +3 -3
  81. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
  82. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
  83. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +7 -7
  84. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
  85. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +3 -3
  86. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -3
  87. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +2 -2
  88. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +6 -9
  89. package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -2
  90. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +2 -2
  91. package/dataflow/internal/process/functions/call/common.js +2 -1
  92. package/dataflow/internal/process/functions/call/known-call-handling.js +2 -2
  93. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
  94. package/dataflow/internal/process/functions/call/named-call-handling.js +1 -1
  95. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +2 -2
  96. package/dataflow/internal/process/functions/process-parameter.js +1 -1
  97. package/dataflow/internal/process/process-uninteresting-leaf.d.ts +1 -1
  98. package/dataflow/internal/process/process-uninteresting-leaf.js +1 -1
  99. package/dataflow/origin/dfg-get-origin.d.ts +1 -1
  100. package/dataflow/origin/dfg-get-symbol-refs.js +6 -6
  101. package/documentation/doc-readme.js +2 -1
  102. package/documentation/doc-util/doc-dfg.d.ts +3 -0
  103. package/documentation/doc-util/doc-dfg.js +5 -7
  104. package/documentation/doc-util/doc-normalized-ast.d.ts +0 -6
  105. package/documentation/doc-util/doc-normalized-ast.js +0 -23
  106. package/documentation/doc-util/doc-structure.js +3 -3
  107. package/documentation/doc-util/doc-types.js +3 -3
  108. package/documentation/wiki-core.js +5 -4
  109. package/documentation/wiki-dataflow-graph.js +14 -12
  110. package/documentation/wiki-interface.js +3 -3
  111. package/documentation/wiki-linter.js +6 -0
  112. package/documentation/wiki-normalized-ast.js +5 -4
  113. package/documentation/wiki-query.js +28 -3
  114. package/linter/linter-rules.d.ts +49 -1
  115. package/linter/linter-rules.js +5 -1
  116. package/linter/rules/problematic-eval.d.ts +44 -0
  117. package/linter/rules/problematic-eval.js +83 -0
  118. package/linter/rules/seeded-randomness.js +2 -2
  119. package/linter/rules/stop-with-call-arg.d.ts +35 -0
  120. package/linter/rules/stop-with-call-arg.js +72 -0
  121. package/linter/rules/useless-loop.d.ts +1 -1
  122. package/package.json +7 -7
  123. package/project/cache/flowr-analyzer-cache.d.ts +1 -1
  124. package/project/cache/flowr-analyzer-cache.js +1 -1
  125. package/project/flowr-analyzer-builder.d.ts +3 -0
  126. package/project/flowr-analyzer.d.ts +1 -1
  127. package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +2 -2
  128. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +1 -1
  129. package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -2
  130. package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
  131. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -2
  132. package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -2
  133. package/queries/catalog/df-shape-query/df-shape-query-executor.js +1 -2
  134. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +3 -3
  135. package/queries/catalog/does-call-query/does-call-query-executor.js +2 -2
  136. package/queries/catalog/does-call-query/does-call-query-format.d.ts +2 -2
  137. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
  138. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +3 -3
  139. package/queries/catalog/input-sources-query/input-sources-query-executor.d.ts +6 -0
  140. package/queries/catalog/input-sources-query/input-sources-query-executor.js +66 -0
  141. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +36 -0
  142. package/queries/catalog/input-sources-query/input-sources-query-format.js +63 -0
  143. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +90 -0
  144. package/queries/catalog/input-sources-query/simple-input-classifier.js +308 -0
  145. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +2 -2
  146. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +1 -1
  147. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -2
  148. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -3
  149. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -2
  150. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +2 -2
  151. package/queries/catalog/location-map-query/location-map-query-executor.js +2 -2
  152. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -2
  153. package/queries/catalog/origin-query/origin-query-executor.d.ts +2 -2
  154. package/queries/catalog/origin-query/origin-query-executor.js +3 -3
  155. package/queries/catalog/origin-query/origin-query-format.d.ts +3 -3
  156. package/queries/catalog/provenance-query/provenance-query-executor.d.ts +6 -0
  157. package/queries/catalog/provenance-query/provenance-query-executor.js +34 -0
  158. package/queries/catalog/provenance-query/provenance-query-format.d.ts +35 -0
  159. package/queries/catalog/provenance-query/provenance-query-format.js +62 -0
  160. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
  161. package/queries/catalog/search-query/search-query-format.js +1 -1
  162. package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -2
  163. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -2
  164. package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -3
  165. package/queries/query.d.ts +17 -1
  166. package/queries/query.js +4 -0
  167. package/r-bridge/lang-4.x/ast/model/model.d.ts +9 -0
  168. package/r-bridge/lang-4.x/ast/model/model.js +10 -1
  169. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +16 -1
  170. package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +2 -0
  171. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +16 -1
  172. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +2 -0
  173. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +16 -1
  174. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +2 -0
  175. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +15 -0
  176. package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +2 -0
  177. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +15 -0
  178. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +2 -0
  179. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +16 -1
  180. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +2 -0
  181. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +16 -1
  182. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +2 -0
  183. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +16 -1
  184. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +2 -0
  185. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +29 -1
  186. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +29 -0
  187. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +16 -1
  188. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +2 -0
  189. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +16 -1
  190. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +2 -0
  191. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +16 -1
  192. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +2 -0
  193. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +16 -1
  194. package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +2 -0
  195. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +16 -1
  196. package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +2 -0
  197. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +16 -1
  198. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +2 -0
  199. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +16 -1
  200. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +2 -0
  201. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +16 -1
  202. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +2 -0
  203. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +16 -1
  204. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +2 -0
  205. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +16 -1
  206. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +2 -0
  207. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +16 -1
  208. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +2 -0
  209. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +16 -1
  210. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +2 -0
  211. package/search/flowr-search-filters.d.ts +1 -1
  212. package/search/flowr-search-printer.js +3 -3
  213. package/search/search-executor/search-enrichers.js +2 -2
  214. package/search/search-executor/search-generators.js +1 -1
  215. package/slicing/criterion/parse.d.ts +43 -18
  216. package/slicing/criterion/parse.js +68 -63
  217. package/slicing/static/slicer-types.d.ts +2 -3
  218. package/slicing/static/static-slicer.d.ts +3 -4
  219. package/slicing/static/static-slicer.js +32 -12
  220. package/util/collections/arrays.d.ts +4 -0
  221. package/util/collections/arrays.js +7 -0
  222. package/util/diff.d.ts +2 -2
  223. package/util/mermaid/ast.js +4 -4
  224. package/util/mermaid/cfg.js +5 -5
  225. package/util/mermaid/dfg.d.ts +33 -18
  226. package/util/mermaid/dfg.js +47 -31
  227. package/util/mermaid/mermaid.d.ts +57 -12
  228. package/util/mermaid/mermaid.js +74 -67
  229. package/util/range.d.ts +8 -0
  230. package/util/range.js +13 -1
  231. package/util/slice-direction.d.ts +7 -0
  232. package/util/slice-direction.js +12 -0
  233. package/util/version.js +1 -1
  234. package/dataflow/graph/invert-dfg.d.ts +0 -6
  235. package/dataflow/graph/invert-dfg.js +0 -20
  236. package/dataflow/graph/resolve-graph.d.ts +0 -8
  237. package/dataflow/graph/resolve-graph.js +0 -59
@@ -4,16 +4,14 @@ exports.printDfGraph = printDfGraph;
4
4
  exports.formatSideEffect = formatSideEffect;
5
5
  exports.printDfGraphForCode = printDfGraphForCode;
6
6
  exports.verifyExpectedSubgraph = verifyExpectedSubgraph;
7
- const dfg_1 = require("../../util/mermaid/dfg");
8
7
  const default_pipelines_1 = require("../../core/steps/pipeline/default-pipelines");
9
8
  const decorate_1 = require("../../r-bridge/lang-4.x/ast/model/processing/decorate");
10
- const resolve_graph_1 = require("../../dataflow/graph/resolve-graph");
11
- const diff_dataflow_graph_1 = require("../../dataflow/graph/diff-dataflow-graph");
12
9
  const assert_1 = require("../../util/assert");
13
10
  const time_1 = require("../../util/text/time");
14
11
  const doc_files_1 = require("./doc-files");
15
12
  const doc_code_1 = require("./doc-code");
16
13
  const flowr_analyzer_context_1 = require("../../project/context/flowr-analyzer-context");
14
+ const df_helper_1 = require("../../dataflow/graph/df-helper");
17
15
  const call_graph_1 = require("../../dataflow/graph/call-graph");
18
16
  /**
19
17
  * Visualizes the dataflow graph as a mermaid graph inside a markdown code block.
@@ -21,7 +19,7 @@ const call_graph_1 = require("../../dataflow/graph/call-graph");
21
19
  */
22
20
  function printDfGraph(graph, mark, simplified = false) {
23
21
  return `
24
- ${(0, doc_code_1.codeBlock)('mermaid', (0, dfg_1.graphToMermaid)({
22
+ ${(0, doc_code_1.codeBlock)('mermaid', df_helper_1.Dataflow.visualize.mermaid.convert({
25
23
  graph,
26
24
  prefix: 'flowchart LR',
27
25
  mark,
@@ -55,7 +53,7 @@ async function printDfGraphForCode(parser, code, { callGraph = false, simplified
55
53
  (0, assert_1.guard)(showCode, 'can not switch code and graph if code is not shown');
56
54
  }
57
55
  const metaInfo = `The analysis required _${(0, time_1.printAsMs)(duration)}_ (including parse and normalize, using the [${parser.name}](${doc_files_1.FlowrWikiBaseRef}/Engines) engine) within the generation environment.`;
58
- const graph = callGraph ? (0, call_graph_1.computeCallGraph)(result.dataflow.graph) : result.dataflow.graph;
56
+ const graph = callGraph ? call_graph_1.CallGraph.compute(result.dataflow.graph) : result.dataflow.graph;
59
57
  const dfGraph = printDfGraph(graph, mark, simplified);
60
58
  const simplyText = simplified ? '(simplified) ' : '';
61
59
  const graphName = callGraph ? 'Call Graph' : 'Dataflow Graph';
@@ -92,8 +90,8 @@ async function verifyExpectedSubgraph(parser, code, expectedSubgraph) {
92
90
  getId: (0, decorate_1.deterministicCountingIdGenerator)(0)
93
91
  }).allRemainingSteps();
94
92
  expectedSubgraph.setIdMap(info.normalize.idMap);
95
- expectedSubgraph = (0, resolve_graph_1.resolveDataflowGraph)(expectedSubgraph, context);
96
- const report = (0, diff_dataflow_graph_1.diffOfDataflowGraphs)({ name: 'expected', graph: expectedSubgraph }, { name: 'got', graph: info.dataflow.graph }, {
93
+ expectedSubgraph = df_helper_1.Dataflow.resolveGraphCriteria(expectedSubgraph, context);
94
+ const report = df_helper_1.Dataflow.diffGraphs({ name: 'expected', graph: expectedSubgraph }, { name: 'got', graph: info.dataflow.graph }, {
97
95
  leftIsSubgraph: true
98
96
  });
99
97
  (0, assert_1.guard)(report.isEqual(), () => `report:\n * ${report.comments()?.join('\n * ') ?? ''}`);
@@ -1,5 +1,3 @@
1
- import type { DataflowGraph } from '../../dataflow/graph/graph';
2
- import type { RShell } from '../../r-bridge/shell';
3
1
  import { type ParentInformation, type RNodeWithParent } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
4
2
  import type { KnownParser } from '../../r-bridge/parser';
5
3
  import type { RProject } from '../../r-bridge/lang-4.x/ast/model/nodes/r-project';
@@ -17,7 +15,3 @@ export interface PrintNormalizedAstOptions {
17
15
  * This is intended for documentation purposes.
18
16
  */
19
17
  export declare function printNormalizedAstForCode(parser: KnownParser, code: string, { showCode, prefix }?: PrintNormalizedAstOptions): Promise<string>;
20
- /**
21
- * returns resolved expected df graph
22
- */
23
- export declare function verifyExpectedSubgraph(shell: RShell, code: string, expectedSubgraph: DataflowGraph): Promise<DataflowGraph>;
@@ -2,12 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.printNormalizedAst = printNormalizedAst;
4
4
  exports.printNormalizedAstForCode = printNormalizedAstForCode;
5
- exports.verifyExpectedSubgraph = verifyExpectedSubgraph;
6
5
  const default_pipelines_1 = require("../../core/steps/pipeline/default-pipelines");
7
- const decorate_1 = require("../../r-bridge/lang-4.x/ast/model/processing/decorate");
8
- const resolve_graph_1 = require("../../dataflow/graph/resolve-graph");
9
- const diff_dataflow_graph_1 = require("../../dataflow/graph/diff-dataflow-graph");
10
- const assert_1 = require("../../util/assert");
11
6
  const ast_1 = require("../../util/mermaid/ast");
12
7
  const time_1 = require("../../util/text/time");
13
8
  const doc_files_1 = require("./doc-files");
@@ -59,22 +54,4 @@ ${(0, ast_1.normalizedAstToMermaid)(result.normalize.ast, { prefix })}
59
54
 
60
55
  ` : '\n(' + metaInfo + ')\n\n');
61
56
  }
62
- /**
63
- * returns resolved expected df graph
64
- */
65
- async function verifyExpectedSubgraph(shell, code, expectedSubgraph) {
66
- /* we verify that we get what we want first! */
67
- const context = (0, flowr_analyzer_context_1.contextFromInput)(code);
68
- const info = await (0, default_pipelines_1.createDataflowPipeline)(shell, {
69
- context: context,
70
- getId: (0, decorate_1.deterministicCountingIdGenerator)(0)
71
- }).allRemainingSteps();
72
- expectedSubgraph.setIdMap(info.normalize.idMap);
73
- expectedSubgraph = (0, resolve_graph_1.resolveDataflowGraph)(expectedSubgraph, context);
74
- const report = (0, diff_dataflow_graph_1.diffOfDataflowGraphs)({ name: 'expected', graph: expectedSubgraph }, { name: 'got', graph: info.dataflow.graph }, {
75
- leftIsSubgraph: true
76
- });
77
- (0, assert_1.guard)(report.isEqual(), () => `report:\n * ${report.comments()?.join('\n * ') ?? ''}`);
78
- return expectedSubgraph;
79
- }
80
57
  //# sourceMappingURL=doc-normalized-ast.js.map
@@ -5,8 +5,8 @@ exports.block = block;
5
5
  exports.section = section;
6
6
  exports.collapsibleToc = collapsibleToc;
7
7
  const doc_general_1 = require("./doc-general");
8
- const mermaid_1 = require("../../util/mermaid/mermaid");
9
8
  const strings_1 = require("../../util/text/strings");
9
+ const mermaid_1 = require("../../util/mermaid/mermaid");
10
10
  /**
11
11
  *
12
12
  */
@@ -31,7 +31,7 @@ ${(0, doc_general_1.prefixLines)(content, '> ')}
31
31
  /**
32
32
  *
33
33
  */
34
- function section(title, depth = 2, anchor = (0, mermaid_1.escapeId)(title)) {
34
+ function section(title, depth = 2, anchor = mermaid_1.Mermaid.escapeId(title)) {
35
35
  return `<h${depth} id="${anchor}">${title}</h${depth}>`;
36
36
  }
37
37
  function strToLink(str) {
@@ -40,7 +40,7 @@ function strToLink(str) {
40
40
  const [, name, link] = match;
41
41
  return `[${name}](${link})`;
42
42
  }
43
- return `[${str}](#${(0, mermaid_1.escapeId)(str)})`;
43
+ return `[${str}](#${mermaid_1.Mermaid.escapeId(str)})`;
44
44
  }
45
45
  /**
46
46
  * Supported pattern: `Name@link`
@@ -54,11 +54,11 @@ const assert_1 = require("../../util/assert");
54
54
  const doc_files_1 = require("./doc-files");
55
55
  const fs_1 = __importDefault(require("fs"));
56
56
  const path_1 = __importDefault(require("path"));
57
- const mermaid_1 = require("../../util/mermaid/mermaid");
58
57
  const doc_code_1 = require("./doc-code");
59
58
  const doc_structure_1 = require("./doc-structure");
60
59
  const html_hover_over_1 = require("../../util/html-hover-over");
61
60
  const doc_general_1 = require("./doc-general");
61
+ const mermaid_1 = require("../../util/mermaid/mermaid");
62
62
  const options = {
63
63
  target: typescript_1.default.ScriptTarget.ESNext,
64
64
  skipLibCheck: true,
@@ -186,7 +186,7 @@ function formatNode(node, sourceFile, typeChecker) {
186
186
  }
187
187
  const type = getType(node, typeChecker);
188
188
  const typeAnnotation = type.includes('=>') ? type.replaceAll(/\s+=>\s+/g, ' ') : ': ' + type;
189
- return `${prefix}${(0, mermaid_1.escapeMarkdown)(name + typeAnnotation)}${suffix}`;
189
+ return `${prefix}${mermaid_1.Mermaid.escape(name + typeAnnotation)}${suffix}`;
190
190
  }
191
191
  function getType(node, typeChecker) {
192
192
  const tryDirect = typeChecker.getTypeAtLocation(node);
@@ -381,7 +381,7 @@ function generateMermaidClassDiagram(hierarchyList, rootName, options, visited =
381
381
  if (node.kind === 'type') {
382
382
  collect.nodeLines.push(`style ${node.name} opacity:.35,fill:#FAFAFA`);
383
383
  }
384
- collect.nodeLines.push(`click ${node.name} href "${getTypePathLink(node)}" "${(0, mermaid_1.escapeMarkdown)(node.comments?.join('; ').replace(/\n/g, ' ') ?? '')}"`);
384
+ collect.nodeLines.push(`click ${node.name} href "${getTypePathLink(node)}" "${mermaid_1.Mermaid.escape(node.comments?.join('; ').replace(/\n/g, ' ') ?? '')}"`);
385
385
  const inline = [...options.inlineTypes ?? [], ...defaultSkip];
386
386
  let baseTypes = node.extends;
387
387
  if (options.reverse) {
@@ -45,6 +45,7 @@ const doc_structure_1 = require("./doc-util/doc-structure");
45
45
  const shell_1 = require("../r-bridge/shell");
46
46
  const log_1 = require("../../test/functionality/_helper/log");
47
47
  const log_2 = require("../util/log");
48
+ const model_1 = require("../r-bridge/lang-4.x/ast/model/model");
48
49
  async function makeAnalyzerExample() {
49
50
  const analyzer = await new flowr_analyzer_builder_1.FlowrAnalyzerBuilder()
50
51
  .configure('ignoreSourceCalls', true)
@@ -308,7 +309,7 @@ If you are interested in the raw token types that we may encounter, have a look
308
309
  The normalization function ${ctx.link(parser_2.normalize)} takes the output from the previous steps and uses the ${ctx.link(format_1.prepareParsedData)} and
309
310
  ${ctx.link(format_1.convertPreparedParsedData)} functions to first transform the serialized parsing output to an object.
310
311
  Next, ${ctx.link(normalize_root_1.normalizeRootObjToAst)} transforms this object to a normalized AST and ${ctx.link(decorate_1.decorateAst)} adds additional information to the AST (like roles, ids, depth, etc.).
311
- While looking at the mermaid visualization of such an AST is nice and usually sufficient, looking at the objects themselves shows you the full range of information the AST provides (all encompassed within the ${ctx.link('RNode')} type).
312
+ While looking at the mermaid visualization of such an AST is nice and usually sufficient, looking at the objects themselves shows you the full range of information the AST provides (all encompassed within the ${ctx.link(model_1.RNode)} type).
312
313
 
313
314
  Let's have a look at the normalized AST for the sample code \`${sampleCode}\` (please refer to the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized-AST) wiki page for more information):
314
315
 
@@ -358,7 +359,7 @@ We use the ${ctx.link(extractor_1.produceDataFlowGraph)} function as an entry po
358
359
  The function is mainly backed by its ${ctx.link('processors')} object which maps each type in the normalized AST to an appropriate handler ("fold-function").
359
360
 
360
361
  To understand these handlers, let's start with the simplest one, ${ctx.link(process_uninteresting_leaf_1.processUninterestingLeaf)} signals that
361
- we do not care about this node and just produce an empty dataflow information (using ${ctx.link(info_1.initializeCleanDataflowInformation)}).
362
+ we do not care about this node and just produce an empty dataflow information (using ${ctx.linkO(info_1.DataflowInformation, 'initialize')}).
362
363
  Looking at the function showcases the general structure of a processor:
363
364
 
364
365
  ${ctx.hierarchy(process_uninteresting_leaf_1.processUninterestingLeaf, { maxDepth: 2, openTop: true })}
@@ -384,7 +385,7 @@ ${ctx.hierarchy(process_value_1.processValue, { maxDepth: 2, openTop: true })}
384
385
 
385
386
  Please note, that we add the [value vertex](${doc_files_1.FlowrWikiBaseRef}/Dataflow-Graph#value-vertex) to the newly created dataflow graph,
386
387
  which holds a reference to the constant. If you are confused with the use of the ${ctx.link('ParentInformation')} type,
387
- this stems from the [AST decoration](#normalization) and signals that we have a decorated ${ctx.link('RNode')} (which may have additional information in \`OtherInfo\`).
388
+ this stems from the [AST decoration](#normalization) and signals that we have a decorated ${ctx.link(model_1.RNode)} (which may have additional information in \`OtherInfo\`).
388
389
 
389
390
  Yet again, this is not very interesting. When looking at the ${ctx.link('processors')} object you may be confused by
390
391
  many lines just mapping the node to the ${ctx.link(process_named_call_1.processAsNamedCall)} function.
@@ -424,7 +425,7 @@ to produce a new dataflow information.
424
425
 
425
426
  Given the [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow-Graph), you can do a lot more!
426
427
  You can issue [queries](${doc_files_1.FlowrWikiBaseRef}/Query-API) to explore the graph, [search](${doc_files_1.FlowrWikiBaseRef}/Search-API) for specific elements, or, for example, request a [static backward slice](#static-backward-slicing).
427
- Of course, all of these endeavors work not just with the ${ctx.link(shell_1.RShell.name)} but also with the [\`tree-sitter\` engine](${doc_files_1.FlowrWikiBaseRef}/Engines).
428
+ Of course, all of these endeavors work not just with the ${ctx.link(shell_1.RShell)} but also with the [\`tree-sitter\` engine](${doc_files_1.FlowrWikiBaseRef}/Engines).
428
429
 
429
430
  ### Static Backward Slicing
430
431
 
@@ -38,11 +38,12 @@ const flowr_analyzer_builder_1 = require("../project/flowr-analyzer-builder");
38
38
  const flowr_analyzer_context_1 = require("../project/context/flowr-analyzer-context");
39
39
  const doc_maker_1 = require("./wiki-mk/doc-maker");
40
40
  const flowr_analyzer_1 = require("../project/flowr-analyzer");
41
- const built_in_1 = require("../dataflow/environments/built-in");
42
41
  const dfg_1 = require("../util/mermaid/dfg");
43
42
  const r_number_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-number");
44
43
  const model_1 = require("../r-bridge/lang-4.x/ast/model/model");
45
44
  const range_1 = require("../util/range");
45
+ const df_helper_1 = require("../dataflow/graph/df-helper");
46
+ const built_in_proc_name_1 = require("../dataflow/environments/built-in-proc-name");
46
47
  async function subExplanation(parser, { description, code, expectedSubgraph }) {
47
48
  expectedSubgraph = await (0, doc_dfg_1.verifyExpectedSubgraph)(parser, code, expectedSubgraph);
48
49
  const marks = [];
@@ -170,7 +171,7 @@ ${(0, doc_structure_1.block)({
170
171
  content: `
171
172
  If you want to obtain the locations where a variable is defined, or read, or re-defined, refrain from tracking these details manually in the dataflow graph
172
173
  as there are some edge-cases that require special attention.
173
- In general, the ${ctx.link(dfg_get_origin_1.getOriginInDfg)} function explained below in [working with the dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph#working-with-the-dataflow-graph) will help you to get the information you need.
174
+ In general, the ${ctx.link(dfg_get_origin_1.getOriginInDfg)} (which is also available as ${ctx.linkO(df_helper_1.Dataflow, 'origin')}) function explained below in [working with the dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph#working-with-the-dataflow-graph) will help you to get the information you need.
174
175
  `
175
176
  })}
176
177
 
@@ -196,8 +197,8 @@ ${ctx.hierarchy('FunctionArgument')}
196
197
 
197
198
  There is another element of potential interest to you, the \`origin\` property which records how flowR created the respective function call.
198
199
  These origins may hold the name of any processor that is part of the ${ctx.link('BuiltInProcName')} enumeration to signal that the respective processor (cf. ${ctx.link('BuiltInProcessorMapper')}) was responsible for creating the vertex.
199
- The entry \`${built_in_1.BuiltInProcName.Function}\` signals that flowR used a processor for a user-defined function defined within the source code, \`${built_in_1.BuiltInProcName.Unnamed}\` signals that the function as an anonymous function definition.
200
- However, in general, flowR may use any fitting handler as an origin (see the ${ctx.link('BuiltInProcName')} enum for a *complete* list). For example, within a access definition, flowR will correspondingly redefine the meaning of \`:=\` to that of the \`${built_in_1.BuiltInProcName.TableAssignment}\`.
200
+ The entry \`${built_in_proc_name_1.BuiltInProcName.Function}\` signals that flowR used a processor for a user-defined function defined within the source code, \`${built_in_proc_name_1.BuiltInProcName.Unnamed}\` signals that the function as an anonymous function definition.
201
+ However, in general, flowR may use any fitting handler as an origin (see the ${ctx.link('BuiltInProcName')} enum for a *complete* list). For example, within a access definition, flowR will correspondingly redefine the meaning of \`:=\` to that of the \`${built_in_proc_name_1.BuiltInProcName.TableAssignment}\`.
201
202
 
202
203
  ${(0, doc_structure_1.details)('Example: Simple Function Call (unresolved)', await (async () => {
203
204
  const code = 'foo(x,3,y=3,)';
@@ -367,7 +368,7 @@ ${(0, doc_structure_1.block)({
367
368
  content: `Now you might be asking yourself how to differentiate anonymous and named functions and what you have to keep in mind when working with them?
368
369
 
369
370
  Unnamed functions have an array of signatures which you can use to identify them.
370
- But in short: the \`origin\` attribute of the ${ctx.link('DataflowGraphVertexFunctionCall')} is \`${built_in_1.BuiltInProcName.Unnamed}\`.
371
+ But in short: the \`origin\` attribute of the ${ctx.link('DataflowGraphVertexFunctionCall')} is \`${built_in_proc_name_1.BuiltInProcName.Unnamed}\`.
371
372
  Please be aware that unnamed functions still have a \`name\` property to give it a unique identifier that can be used for debugging and reference.
372
373
  This name _always_ starts with \`${unnamed_call_handling_1.UnnamedFunctionCallPrefix}\`.
373
374
 
@@ -1052,7 +1053,8 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(treeSitter, 'alias <- unknown\nalias(
1052
1053
  ${(0, doc_structure_1.section)('Working with the Dataflow Graph', 2, 'dfg-working')}
1053
1054
 
1054
1055
  The ${ctx.link('DataflowInformation')} is the core result of _flowR_ and summarizes a lot of information.
1055
- Depending on what you are interested in, there exists a plethora of functions and queries to help you out, answering the most important questions:
1056
+ Depending on what you are interested in, there exists a plethora of functions and queries to help you out, answering the most important questions.
1057
+ Generally, we recommend you check out the ${ctx.link(df_helper_1.Dataflow, undefined, { type: 'variable' })} helper object!
1056
1058
 
1057
1059
  * The **${ctx.linkPage('wiki/Query API')}** provides many functions to query the dataflow graph for specific information (dependencies, calls, slices, clusters, ...)
1058
1060
  * The **${ctx.linkPage('wiki/Search API')}** allows you to search for specific vertices or edges in the dataflow graph or the original program
@@ -1064,9 +1066,9 @@ Depending on what you are interested in, there exists a plethora of functions an
1064
1066
 
1065
1067
  FlowR also provides various helper objects (with the same name as the corresponding type) to help you work with the dataflow graph:
1066
1068
 
1067
- * ${ctx.link('DfEdge', undefined, { type: 'variable' })} to get helpful functions wrt. edges (see [below](#dfg-resolving-values))
1068
- * ${ctx.link('Identifier', undefined, { type: 'variable' })} to get helpful functions wrt. identifiers
1069
- * ${ctx.link('FunctionArgument', undefined, { type: 'variable' })} to get helpful functions wrt. function arguments
1069
+ * ${ctx.link(edge_1.DfEdge, undefined, { type: 'variable' })} to get helpful functions wrt. edges (see [below](#dfg-resolving-values))
1070
+ * ${ctx.link(identifier_1.Identifier, undefined, { type: 'variable' })} to get helpful functions wrt. identifiers
1071
+ * ${ctx.link(graph_1.FunctionArgument, undefined, { type: 'variable' })} to get helpful functions wrt. function arguments
1070
1072
 
1071
1073
  Some of these functions have been explained in their respective wiki pages. However, some are part of the ${ctx.linkPage('wiki/Dataflow Graph', 'Dataflow Graph API')} and so we explain them here.
1072
1074
  If you are interested in which features we support and which features are still to be worked on, please refer to our ${ctx.linkPage('wiki/Capabilities', 'capabilities')} page.
@@ -1107,14 +1109,14 @@ ${await (async () => {
1107
1109
  }
1108
1110
  throw new Error('Could not find edge');
1109
1111
  })()}&mdash;which is usually not very helpful.
1110
- You can use ${ctx.link('DfEdge::splitTypes')} to get the individual bitmasks of all included types, and
1111
- ${ctx.link('DfEdge::includesType')} to check whether a specific type (or one of a collection of types) is included in the edge.
1112
+ You can use ${ctx.linkO(edge_1.DfEdge, 'splitTypes')} to get the individual bitmasks of all included types, and
1113
+ ${ctx.linkO(edge_1.DfEdge, 'includesType')} to check whether a specific type (or one of a collection of types) is included in the edge.
1112
1114
 
1113
1115
  ${(0, doc_structure_1.section)('Handling Origins', 3, 'dfg-handling-origins')}
1114
1116
 
1115
1117
  If you are writing another analysis on top of the dataflow graph, you probably want to know all definitions that serve as the source of a read, all functions
1116
1118
  that are called by an invocation, and more.
1117
- For this, the ${ctx.link(dfg_get_origin_1.getOriginInDfg)} function provides you with a collection of ${ctx.link('Origin')} objects:
1119
+ For this, the ${ctx.link(dfg_get_origin_1.getOriginInDfg)} (this is also accessible with ${ctx.linkO(df_helper_1.Dataflow, 'origin')}) function provides you with a collection of ${ctx.link('Origin')} objects:
1118
1120
 
1119
1121
  ${ctx.hierarchy('Origin', { openTop: true })}
1120
1122
 
@@ -18,8 +18,8 @@ const flowr_main_options_1 = require("../cli/flowr-main-options");
18
18
  const doc_issue_1 = require("./doc-util/doc-issue");
19
19
  const doc_structure_1 = require("./doc-util/doc-structure");
20
20
  const doc_maker_1 = require("./wiki-mk/doc-maker");
21
- const built_in_1 = require("../dataflow/environments/built-in");
22
21
  const doc_writing_code_1 = require("./data/interface/doc-writing-code");
22
+ const built_in_proc_name_1 = require("../dataflow/environments/built-in-proc-name");
23
23
  async function explainServer(parser) {
24
24
  (0, doc_data_server_messages_1.documentAllServerMessages)();
25
25
  return `
@@ -236,7 +236,7 @@ ${(0, doc_code_1.codeBlock)('json', JSON.stringify({
236
236
  environment: {
237
237
  overwriteBuiltIns: {
238
238
  definitions: [
239
- { type: 'function', names: ['foo'], processor: built_in_1.BuiltInProcName.Assignment, config: {} }
239
+ { type: 'function', names: ['foo'], processor: built_in_proc_name_1.BuiltInProcName.Assignment, config: {} }
240
240
  ]
241
241
  }
242
242
  }
@@ -290,7 +290,7 @@ ${(0, doc_code_1.codeBlock)('json', JSON.stringify({
290
290
  | Type | Description | Example |
291
291
  | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
292
292
  | \`constant\` | Additionally allows for a \`value\` this should resolve to. | \`{ type: 'constant', names: ['NULL', 'NA'], value: null }\` |
293
- | \`function\` | Is a rather flexible way to define and bind built-in functions. For the time, we do not have extensive documentation to cover all the cases, so please either consult the sources with the \`default-builtin-config.ts\` or open a [new issue](${doc_issue_1.NewIssueUrl}). | \`{ type: 'function', names: ['next'], processor: '${built_in_1.BuiltInProcName.Default}', config: { cfg: ExitPointType.Next } }\` |
293
+ | \`function\` | Is a rather flexible way to define and bind built-in functions. For the time, we do not have extensive documentation to cover all the cases, so please either consult the sources with the \`default-builtin-config.ts\` or open a [new issue](${doc_issue_1.NewIssueUrl}). | \`{ type: 'function', names: ['next'], processor: '${built_in_proc_name_1.BuiltInProcName.Default}', config: { cfg: ExitPointType.Next } }\` |
294
294
  | \`replacement\` | A comfortable way to specify replacement functions like \`$<-\` or \`names<-\`. \`suffixes\` describes the... suffixes to attach automatically. | \`{ type: 'replacement', suffixes: ['<-', '<<-'], names: ['[', '[['] }\` |
295
295
 
296
296
 
@@ -122,6 +122,12 @@ df[6, "value"]
122
122
  `, tagTypes);
123
123
  rule(knownParser, 'dead-code', 'DeadCodeConfig', 'DEAD_CODE', 'lint-dead-code', 'if(TRUE) 1 else 2', tagTypes);
124
124
  rule(knownParser, 'useless-loop', 'UselessLoopConfig', 'USELESS_LOOP', 'lint-useless-loop', 'for(i in c(1)) { print(i) }', tagTypes);
125
+ rule(knownParser, 'stop-call', 'StopWithCallConfig', 'STOP_WITH_CALL_ARG', 'lint-stop-call', 'stop(42)', tagTypes);
126
+ rule(knownParser, 'problematic-eval', 'ProblematicEvalConfig', 'PROBLEMATIC_EVAL', 'lint-problematic-eval', `
127
+ function(x) {
128
+ eval(x)
129
+ }
130
+ `, tagTypes);
125
131
  function rule(parser, name, configType, ruleType, testfile, example, types) {
126
132
  const rule = linter_rules_1.LintingRules[name];
127
133
  const tags = rule.info.tags.toSorted((a, b) => {
@@ -16,6 +16,7 @@ const roxygen_parse_1 = require("../r-bridge/roxygen2/roxygen-parse");
16
16
  const r_binary_op_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-binary-op");
17
17
  const model_1 = require("../r-bridge/lang-4.x/ast/model/model");
18
18
  const r_project_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-project");
19
+ const r_expression_list_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-expression-list");
19
20
  async function quickNormalizedAstMultipleFiles() {
20
21
  const analyzer = await new flowr_analyzer_builder_1.FlowrAnalyzerBuilder()
21
22
  .setEngine('tree-sitter')
@@ -95,8 +96,8 @@ ${await (0, doc_normalized_ast_1.printNormalizedAstForCode)(treeSitter, 'x <- 2
95
96
  > you can either use the [Visual Studio Code extension](${doc_files_1.FlowrGithubBaseRef}/vscode-flowr) or the ${(0, doc_cli_option_1.getReplCommand)('normalize*')}
96
97
  > command in the REPL (see the [Interface wiki page](${doc_files_1.FlowrWikiBaseRef}/Interface) for more information).
97
98
 
98
- Indicative of the normalization is the root ${ctx.link('RProject')} node, which is present in every normalized AST
99
- and provides the ${ctx.link('RExpressionList')} nodes for each file in the project.
99
+ Indicative of the normalization is the root ${ctx.link(r_project_1.RProject)} node, which is present in every normalized AST
100
+ and provides the ${ctx.link(r_expression_list_1.RExpressionList)} nodes for each file in the project.
100
101
  In general, we provide node types for:
101
102
 
102
103
  1. literals (e.g., numbers and strings)
@@ -112,7 +113,7 @@ In general, we provide node types for:
112
113
  Every node is a link, which directly refers to the implementation in the source code.
113
114
  Grayed-out parts are used for structuring the AST, grouping together related nodes.
114
115
 
115
- ${(0, doc_code_1.codeBlock)('mermaid', ctx.mermaid('RNode'))}
116
+ ${(0, doc_code_1.codeBlock)('mermaid', ctx.mermaid(model_1.RNode))}
116
117
 
117
118
  </details>
118
119
 
@@ -123,7 +124,7 @@ Most notably, the \`info\` field holds the \`id\` of the node, which is used to
123
124
 
124
125
  In summary, we have the following types:
125
126
 
126
- ${(0, doc_structure_1.details)('Normalized AST Node Types', ctx.hierarchy('RNode', { collapseFromNesting: Number.MAX_VALUE, ignoredTypes: ['Info', 'LogLevel'] }))}
127
+ ${(0, doc_structure_1.details)('Normalized AST Node Types', ctx.hierarchy(model_1.RNode, { collapseFromNesting: Number.MAX_VALUE, ignoredTypes: ['Info', 'LogLevel'] }))}
127
128
 
128
129
  The following segments intend to give you an overview of how to work with the normalized AST:
129
130
 
@@ -29,7 +29,6 @@ const vertex_1 = require("../dataflow/graph/vertex");
29
29
  const control_flow_query_executor_1 = require("../queries/catalog/control-flow-query/control-flow-query-executor");
30
30
  const doc_cfg_1 = require("./doc-util/doc-cfg");
31
31
  const df_shape_query_executor_1 = require("../queries/catalog/df-shape-query/df-shape-query-executor");
32
- const _00_slice_1 = require("../core/steps/all/static-slicing/00-slice");
33
32
  const doc_repl_1 = require("./doc-util/doc-repl");
34
33
  const inspect_higher_order_query_executor_1 = require("../queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor");
35
34
  const doc_escape_1 = require("./doc-util/doc-escape");
@@ -39,6 +38,8 @@ const call_graph_query_executor_1 = require("../queries/catalog/call-graph-query
39
38
  const inspect_recursion_query_executor_1 = require("../queries/catalog/inspect-recursion-query/inspect-recursion-query-executor");
40
39
  const does_call_query_executor_1 = require("../queries/catalog/does-call-query/does-call-query-executor");
41
40
  const inspect_exception_query_executor_1 = require("../queries/catalog/inspect-exceptions-query/inspect-exception-query-executor");
41
+ const slice_direction_1 = require("../util/slice-direction");
42
+ const provenance_query_executor_1 = require("../queries/catalog/provenance-query/provenance-query-executor");
42
43
  (0, doc_query_1.registerQueryDocumentation)('call-context', {
43
44
  name: 'Call-Context Query',
44
45
  type: 'active',
@@ -554,7 +555,7 @@ To specify a variable of interest, you have to present flowR with a [slicing cri
554
555
 
555
556
  To exemplify the capabilities, consider the following code:
556
557
  ${(0, doc_code_1.codeBlock)('r', exampleCode)}
557
- If you are interested in the parts required for the use of \`x\` in the last line, you can use the following query:
558
+ If you are interested in the parts required for the use of \`x\` in the last line and \`z\`, you can use the following query:
558
559
 
559
560
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
560
561
  type: 'static-slice',
@@ -575,7 +576,7 @@ Likewise, if you want the forward slice for the first use of \`x\`, you can do i
575
576
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
576
577
  type: 'static-slice',
577
578
  criteria: ['1@x'],
578
- direction: _00_slice_1.SliceDirection.Forward
579
+ direction: slice_direction_1.SliceDirection.Forward
579
580
  }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)(['1@x'], (0, doc_escape_1.escapeNewline)(exampleCode), true) })}
580
581
 
581
582
  You can disable [magic comments](${doc_files_1.FlowrWikiBaseRef}/Interface#slice-magic-comments) using the \`noMagicComments\` flag.
@@ -583,6 +584,30 @@ This query replaces the old [\`request-slice\`](${doc_files_1.FlowrWikiBaseRef}/
583
584
  `;
584
585
  }
585
586
  });
587
+ (0, doc_query_1.registerQueryDocumentation)('provenance', {
588
+ name: 'Provenance Query',
589
+ type: 'active',
590
+ shortDescription: 'Calculate the provenance of a given variable, optionally restricted to its enveloping fdef',
591
+ functionName: provenance_query_executor_1.executeProvenanceQuery.name,
592
+ functionFile: '../queries/catalog/provenance-query/provenance-query-executor.ts',
593
+ buildExplanation: async (shell) => {
594
+ const exampleCode = 'x <- 1\ny <- 2\nz <- 3\nx';
595
+ const criterion = '4@x';
596
+ return `
597
+ Given a [slicing criterion](${doc_files_1.FlowrWikiBaseRef}/Terminology#slicing-criterion), flowR will return the provenance
598
+ of the given program element (i.e., all related vertices in a non-interprocedural and non-context sensitive backward slice).
599
+
600
+ To exemplify the capabilities, consider the following code:
601
+ ${(0, doc_code_1.codeBlock)('r', exampleCode)}
602
+ If you are interested in the provenance of the \`x\` in the last line you can use:
603
+
604
+ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
605
+ type: 'provenance',
606
+ criterion
607
+ }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)([criterion], (0, doc_escape_1.escapeNewline)(exampleCode)) })}
608
+ `;
609
+ }
610
+ });
586
611
  (0, doc_query_1.registerQueryDocumentation)('dependencies', {
587
612
  name: 'Dependencies Query',
588
613
  type: 'active',
@@ -277,10 +277,58 @@ export declare const LintingRules: {
277
277
  readonly certainty: import("./linter-format").LintingRuleCertainty.BestEffort;
278
278
  readonly tags: readonly [import("./linter-tags").LintingRuleTag.Smell, import("./linter-tags").LintingRuleTag.Readability];
279
279
  readonly defaultConfig: {
280
- readonly loopyFunctions: Set<import("../dataflow/environments/built-in").BuiltInProcName>;
280
+ readonly loopyFunctions: Set<import("../dataflow/environments/built-in-proc-name").BuiltInProcName>;
281
281
  };
282
282
  };
283
283
  };
284
+ readonly 'problematic-eval': {
285
+ readonly createSearch: (config: import("./rules/problematic-eval").ProblematicEvalConfig) => import("../search/flowr-search-builder").FlowrSearchBuilder<"from-query", [], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>;
286
+ readonly processSearchResult: (elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, _config: import("./rules/problematic-eval").ProblematicEvalConfig, data: {
287
+ normalize: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
288
+ dataflow: import("../dataflow/info").DataflowInformation;
289
+ cfg: import("../control-flow/control-flow-graph").ControlFlowInformation;
290
+ analyzer: import("../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
291
+ }) => Promise<{
292
+ results: import("./rules/problematic-eval").ProblematicEvalResult[];
293
+ ".meta": import("./rules/problematic-eval").ProblematicEvalMetadata;
294
+ }>;
295
+ readonly prettyPrint: {
296
+ readonly query: (result: import("./rules/problematic-eval").ProblematicEvalResult) => string;
297
+ readonly full: (result: import("./rules/problematic-eval").ProblematicEvalResult) => string;
298
+ };
299
+ readonly info: {
300
+ readonly name: "Problematic eval";
301
+ readonly description: "Detects uses of eval-like functions whose inputs are not statically constant. Prints the computed input-sources for the eval and flags usages that depend on non-constant/trusted inputs.";
302
+ readonly tags: readonly [import("./linter-tags").LintingRuleTag.Security, import("./linter-tags").LintingRuleTag.Smell, import("./linter-tags").LintingRuleTag.Readability, import("./linter-tags").LintingRuleTag.Performance];
303
+ readonly certainty: import("./linter-format").LintingRuleCertainty.BestEffort;
304
+ readonly defaultConfig: {
305
+ readonly considerAsEval: "^eval$";
306
+ };
307
+ };
308
+ };
309
+ readonly 'stop-call': {
310
+ readonly createSearch: () => import("../search/flowr-search-builder").FlowrSearchBuilder<"get", ["filter"], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, Promise<import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, [] | import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>>;
311
+ readonly processSearchResult: (elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, _config: import("../util/objects").MergeableRecord, { dataflow, analyzer }: {
312
+ normalize: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
313
+ dataflow: import("../dataflow/info").DataflowInformation;
314
+ cfg: import("../control-flow/control-flow-graph").ControlFlowInformation;
315
+ analyzer: import("../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
316
+ }) => {
317
+ results: import("ts-essentials").Writable<import("./rules/stop-with-call-arg").StopWithCallResult>[];
318
+ '.meta': import("./rules/stop-with-call-arg").StopWithCallMetadata;
319
+ };
320
+ readonly prettyPrint: {
321
+ readonly query: (result: import("./rules/stop-with-call-arg").StopWithCallResult) => string;
322
+ readonly full: (result: import("./rules/stop-with-call-arg").StopWithCallResult) => string;
323
+ };
324
+ readonly info: {
325
+ readonly name: "Stop without call.=False argument";
326
+ readonly tags: readonly [import("./linter-tags").LintingRuleTag.Smell];
327
+ readonly certainty: import("./linter-format").LintingRuleCertainty.BestEffort;
328
+ readonly description: "Checks whether stop calls without call. argument set to FALSE are used.";
329
+ readonly defaultConfig: {};
330
+ };
331
+ };
284
332
  };
285
333
  export type LintingRuleNames = keyof typeof LintingRules;
286
334
  export type LintingRuleMetadata<Name extends LintingRuleNames> = typeof LintingRules[Name] extends LintingRule<infer _Result, infer Metadata, infer _Config, infer _Info, infer _Elements> ? Metadata : never;
@@ -11,6 +11,8 @@ const naming_convention_1 = require("./rules/naming-convention");
11
11
  const dataframe_access_validation_1 = require("./rules/dataframe-access-validation");
12
12
  const useless_loop_1 = require("./rules/useless-loop");
13
13
  const network_functions_1 = require("./rules/network-functions");
14
+ const stop_with_call_arg_1 = require("./rules/stop-with-call-arg");
15
+ const problematic_eval_1 = require("./rules/problematic-eval");
14
16
  /**
15
17
  * The registry of currently supported linting rules.
16
18
  * A linting rule can be executed on a dataflow pipeline result using {@link executeLintingRule}.
@@ -25,6 +27,8 @@ exports.LintingRules = {
25
27
  'network-functions': network_functions_1.NETWORK_FUNCTIONS,
26
28
  'dataframe-access-validation': dataframe_access_validation_1.DATA_FRAME_ACCESS_VALIDATION,
27
29
  'dead-code': dead_code_1.DEAD_CODE,
28
- 'useless-loop': useless_loop_1.USELESS_LOOP
30
+ 'useless-loop': useless_loop_1.USELESS_LOOP,
31
+ 'problematic-eval': problematic_eval_1.PROBLEMATIC_EVAL,
32
+ 'stop-call': stop_with_call_arg_1.STOP_WITH_CALL_ARG
29
33
  };
30
34
  //# sourceMappingURL=linter-rules.js.map
@@ -0,0 +1,44 @@
1
+ import { type LintingResult, LintingRuleCertainty } from '../linter-format';
2
+ import type { MergeableRecord } from '../../util/objects';
3
+ import { SourceLocation } from '../../util/range';
4
+ import { LintingRuleTag } from '../linter-tags';
5
+ import type { InputSources } from '../../queries/catalog/input-sources-query/simple-input-classifier';
6
+ /**
7
+ * Describes a linting result for a problematic eval usage, including the location of the eval call and the computed input sources that lead to it.
8
+ */
9
+ export interface ProblematicEvalResult extends LintingResult {
10
+ loc: SourceLocation;
11
+ sources: InputSources;
12
+ }
13
+ export interface ProblematicEvalConfig extends MergeableRecord {
14
+ /**
15
+ * All calls that should be considered to be valid eval entry points, this will be interpreted as a Regex!
16
+ */
17
+ considerAsEval: string;
18
+ }
19
+ export type ProblematicEvalMetadata = MergeableRecord;
20
+ export declare const PROBLEMATIC_EVAL: {
21
+ readonly createSearch: (config: ProblematicEvalConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from-query", [], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>;
22
+ readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, _config: ProblematicEvalConfig, data: {
23
+ normalize: import("../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
24
+ dataflow: import("../../dataflow/info").DataflowInformation;
25
+ cfg: import("../../control-flow/control-flow-graph").ControlFlowInformation;
26
+ analyzer: import("../../project/flowr-analyzer").ReadonlyFlowrAnalysisProvider;
27
+ }) => Promise<{
28
+ results: ProblematicEvalResult[];
29
+ ".meta": ProblematicEvalMetadata;
30
+ }>;
31
+ readonly prettyPrint: {
32
+ readonly query: (result: ProblematicEvalResult) => string;
33
+ readonly full: (result: ProblematicEvalResult) => string;
34
+ };
35
+ readonly info: {
36
+ readonly name: "Problematic eval";
37
+ readonly description: "Detects uses of eval-like functions whose inputs are not statically constant. Prints the computed input-sources for the eval and flags usages that depend on non-constant/trusted inputs.";
38
+ readonly tags: readonly [LintingRuleTag.Security, LintingRuleTag.Smell, LintingRuleTag.Readability, LintingRuleTag.Performance];
39
+ readonly certainty: LintingRuleCertainty.BestEffort;
40
+ readonly defaultConfig: {
41
+ readonly considerAsEval: "^eval$";
42
+ };
43
+ };
44
+ };