@eagleoutice/flowr 2.11.1 → 2.12.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 (264) hide show
  1. package/README.md +187 -257
  2. package/abstract-interpretation/absint-visitor.d.ts +1 -0
  3. package/abstract-interpretation/data-frame/mappers/arguments.js +7 -1
  4. package/abstract-interpretation/domains/set-range-domain.js +1 -1
  5. package/abstract-interpretation/domains/set-upper-bound-domain.js +6 -2
  6. package/benchmark/slicer.d.ts +1 -1
  7. package/benchmark/slicer.js +3 -1
  8. package/benchmark/summarizer/second-phase/graph.js +5 -0
  9. package/cli/common/options.d.ts +8 -0
  10. package/cli/common/options.js +2 -0
  11. package/cli/common/scripts-info.d.ts +8 -0
  12. package/cli/repl/commands/repl-commands.d.ts +1 -0
  13. package/cli/repl/commands/repl-commands.js +66 -15
  14. package/cli/repl/commands/repl-dataflow.js +48 -4
  15. package/cli/repl/commands/repl-main.d.ts +2 -0
  16. package/cli/repl/commands/repl-main.js +5 -0
  17. package/cli/repl/commands/repl-query.d.ts +4 -1
  18. package/cli/repl/commands/repl-query.js +72 -22
  19. package/cli/repl/commands/repl-signature.d.ts +7 -0
  20. package/cli/repl/commands/repl-signature.js +119 -0
  21. package/cli/repl/core.d.ts +8 -1
  22. package/cli/repl/core.js +46 -6
  23. package/cli/repl/ghost-hint.d.ts +37 -0
  24. package/cli/repl/ghost-hint.js +72 -0
  25. package/cli/repl/parser/slice-query-parser.d.ts +11 -1
  26. package/cli/repl/parser/slice-query-parser.js +45 -16
  27. package/cli/repl/print-version.d.ts +2 -4
  28. package/cli/repl/print-version.js +41 -23
  29. package/cli/repl/server/connection.js +19 -17
  30. package/cli/slicer-app.d.ts +2 -0
  31. package/cli/slicer-app.js +3 -3
  32. package/cli/wiki.d.ts +2 -2
  33. package/cli/wiki.js +2 -2
  34. package/config.d.ts +63 -2
  35. package/config.js +64 -8
  36. package/control-flow/cfg-dead-code.js +0 -1
  37. package/control-flow/control-flow-graph.js +6 -6
  38. package/control-flow/diff-cfg.js +2 -2
  39. package/control-flow/semantic-cfg-guided-visitor.js +2 -0
  40. package/core/print/slice-diff-ansi.js +8 -8
  41. package/core/steps/all/core/20-dataflow.d.ts +2 -2
  42. package/core/steps/all/static-slicing/00-slice.d.ts +5 -0
  43. package/core/steps/all/static-slicing/00-slice.js +1 -1
  44. package/core/steps/all/static-slicing/10-reconstruct.d.ts +7 -0
  45. package/core/steps/all/static-slicing/10-reconstruct.js +6 -2
  46. package/core/steps/pipeline/default-pipelines.d.ts +20 -16
  47. package/data/r-base-packages.generated.d.ts +44 -0
  48. package/data/r-base-packages.generated.js +32 -0
  49. package/data/r-base-primitives.generated.d.ts +1 -0
  50. package/data/r-base-primitives.generated.js +15 -0
  51. package/data/sigdb/sigdb.remote.json +112 -0
  52. package/dataflow/environments/built-in-proc-name.d.ts +4 -0
  53. package/dataflow/environments/built-in-proc-name.js +4 -0
  54. package/dataflow/environments/built-in.d.ts +14 -4
  55. package/dataflow/environments/built-in.js +13 -2
  56. package/dataflow/environments/data-masking-functions.d.ts +12 -0
  57. package/dataflow/environments/data-masking-functions.js +46 -0
  58. package/dataflow/environments/default-builtin-config.d.ts +72 -19
  59. package/dataflow/environments/default-builtin-config.js +48 -14
  60. package/dataflow/environments/diff.js +1 -1
  61. package/dataflow/environments/environment.js +1 -2
  62. package/dataflow/environments/identifier.d.ts +11 -4
  63. package/dataflow/environments/identifier.js +28 -10
  64. package/dataflow/environments/resolve-by-name.js +16 -2
  65. package/dataflow/extractor.js +6 -3
  66. package/dataflow/graph/call-graph.d.ts +2 -2
  67. package/dataflow/graph/df-helper.d.ts +4 -4
  68. package/dataflow/graph/diff-dataflow-graph.js +2 -2
  69. package/dataflow/graph/edge.d.ts +3 -3
  70. package/dataflow/graph/edge.js +3 -3
  71. package/dataflow/graph/graph-helper.d.ts +2 -2
  72. package/dataflow/internal/linker.js +1 -1
  73. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +7 -0
  74. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +20 -0
  75. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +1 -0
  76. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +2 -49
  77. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +6 -1
  78. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +7 -1
  79. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +19 -0
  80. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +111 -6
  81. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +13 -0
  82. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -3
  83. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +9 -0
  84. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +19 -0
  85. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +12 -4
  86. package/dataflow/internal/process/functions/call/common.js +8 -1
  87. package/dataflow/internal/process/functions/call/default-call-handling.js +6 -0
  88. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +17 -0
  89. package/dataflow/internal/process/functions/call/known-call-handling.js +32 -0
  90. package/dataflow/internal/process/functions/call/named-call-handling.js +29 -7
  91. package/dataflow/internal/process/functions/process-argument.js +12 -1
  92. package/dataflow/internal/process/process-named-call.d.ts +18 -1
  93. package/dataflow/internal/process/process-named-call.js +94 -0
  94. package/dataflow/processor.d.ts +18 -0
  95. package/documentation/data/faq/faqs.js +5 -1
  96. package/documentation/doc-capabilities.js +1 -1
  97. package/documentation/doc-util/doc-cli-option.d.ts +10 -0
  98. package/documentation/doc-util/doc-cli-option.js +23 -0
  99. package/documentation/doc-util/doc-dfg.js +2 -1
  100. package/documentation/doc-util/doc-query.d.ts +9 -3
  101. package/documentation/doc-util/doc-query.js +9 -4
  102. package/documentation/wiki-dataflow-graph.js +8 -5
  103. package/documentation/wiki-interface.js +4 -2
  104. package/documentation/wiki-linter.js +1 -1
  105. package/documentation/wiki-linting-and-testing.js +4 -1
  106. package/documentation/wiki-mk/doc-context.d.ts +14 -0
  107. package/documentation/wiki-mk/doc-context.js +3 -0
  108. package/documentation/wiki-mk/doc-maker.js +3 -1
  109. package/documentation/wiki-query.js +36 -15
  110. package/documentation/wiki-setup.js +10 -7
  111. package/documentation/wiki-signature-database.d.ts +16 -0
  112. package/documentation/wiki-signature-database.js +293 -0
  113. package/linter/linter-format.d.ts +7 -0
  114. package/linter/linter-rules.d.ts +10 -9
  115. package/linter/rules/naming-convention.d.ts +1 -0
  116. package/linter/rules/naming-convention.js +2 -0
  117. package/linter/rules/no-leaked-credentials.js +1 -2
  118. package/linter/rules/roxygen-arguments.js +18 -5
  119. package/linter/rules/stop-with-call-arg.js +2 -2
  120. package/linter/rules/undefined-symbol-util.d.ts +36 -0
  121. package/linter/rules/undefined-symbol-util.js +149 -0
  122. package/linter/rules/undefined-symbol.d.ts +58 -17
  123. package/linter/rules/undefined-symbol.js +143 -33
  124. package/linter/rules/unused-definition.d.ts +8 -1
  125. package/linter/rules/unused-definition.js +126 -1
  126. package/package.json +22 -10
  127. package/project/context/abstract-flowr-analyzer-context.js +7 -1
  128. package/project/context/flowr-analyzer-context.d.ts +8 -0
  129. package/project/context/flowr-analyzer-context.js +10 -0
  130. package/project/context/flowr-analyzer-dependencies-context.d.ts +28 -4
  131. package/project/context/flowr-analyzer-dependencies-context.js +51 -2
  132. package/project/context/flowr-analyzer-files-context.d.ts +1 -0
  133. package/project/context/flowr-analyzer-files-context.js +2 -1
  134. package/project/context/flowr-analyzer-functions-context.js +1 -1
  135. package/project/context/flowr-file.d.ts +5 -0
  136. package/project/context/flowr-file.js +5 -0
  137. package/project/flowr-analyzer-builder.js +12 -2
  138. package/project/plugins/file-plugins/files/flowr-description-file.js +6 -3
  139. package/project/plugins/file-plugins/files/flowr-namespace-file.js +9 -3
  140. package/project/plugins/file-plugins/files/flowr-news-file.js +1 -3
  141. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.d.ts +26 -0
  142. package/project/plugins/file-plugins/flowr-analyzer-inst-file-plugin.js +39 -0
  143. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +1 -1
  144. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +2 -2
  145. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +1 -0
  146. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +18 -2
  147. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +19 -0
  148. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +120 -0
  149. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +518 -0
  150. package/project/plugins/package-version-plugins/package.d.ts +5 -3
  151. package/project/plugins/package-version-plugins/package.js +27 -25
  152. package/project/plugins/plugin-registry.d.ts +3 -2
  153. package/project/plugins/plugin-registry.js +4 -2
  154. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +7 -2
  155. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +3 -1
  156. package/project/sigdb/build.d.ts +131 -0
  157. package/project/sigdb/build.js +628 -0
  158. package/project/sigdb/codec.d.ts +51 -0
  159. package/project/sigdb/codec.js +122 -0
  160. package/project/sigdb/decode.d.ts +58 -0
  161. package/project/sigdb/decode.js +129 -0
  162. package/project/sigdb/decompress.d.ts +44 -0
  163. package/project/sigdb/decompress.js +176 -0
  164. package/project/sigdb/hash.d.ts +9 -0
  165. package/project/sigdb/hash.js +54 -0
  166. package/project/sigdb/index-format.d.ts +40 -0
  167. package/project/sigdb/index-format.js +28 -0
  168. package/project/sigdb/manifest.d.ts +68 -0
  169. package/project/sigdb/manifest.js +146 -0
  170. package/project/sigdb/reader.d.ts +250 -0
  171. package/project/sigdb/reader.js +692 -0
  172. package/project/sigdb/schema.d.ts +196 -0
  173. package/project/sigdb/schema.js +33 -0
  174. package/project/sigdb/sigdb-download.d.ts +65 -0
  175. package/project/sigdb/sigdb-download.js +237 -0
  176. package/project/sigdb/signature-match.d.ts +26 -0
  177. package/project/sigdb/signature-match.js +40 -0
  178. package/project/sigdb/version.d.ts +20 -0
  179. package/project/sigdb/version.js +55 -0
  180. package/queries/catalog/absint-query/absint-query-executor.d.ts +6 -0
  181. package/queries/catalog/absint-query/absint-query-executor.js +63 -0
  182. package/queries/catalog/absint-query/absint-query-format.d.ts +37 -0
  183. package/queries/catalog/absint-query/absint-query-format.js +102 -0
  184. package/queries/catalog/call-context-query/call-context-query-executor.js +1 -3
  185. package/queries/catalog/config-query/config-query-format.d.ts +3 -1
  186. package/queries/catalog/config-query/config-query-format.js +68 -9
  187. package/queries/catalog/dataflow-query/dataflow-query-format.js +11 -1
  188. package/queries/catalog/dependencies-query/dependencies-query-executor.js +1 -1
  189. package/queries/catalog/linter-query/linter-query-executor.d.ts +2 -0
  190. package/queries/catalog/linter-query/linter-query-executor.js +6 -1
  191. package/queries/catalog/linter-query/linter-query-format.d.ts +2 -1
  192. package/queries/catalog/linter-query/linter-query-format.js +40 -8
  193. package/queries/catalog/project-query/project-query-executor.d.ts +15 -0
  194. package/queries/catalog/project-query/project-query-executor.js +96 -4
  195. package/queries/catalog/project-query/project-query-format.d.ts +44 -0
  196. package/queries/catalog/project-query/project-query-format.js +33 -2
  197. package/queries/catalog/signature-query/signature-query-executor.d.ts +29 -0
  198. package/queries/catalog/signature-query/signature-query-executor.js +461 -0
  199. package/queries/catalog/signature-query/signature-query-format.d.ts +138 -0
  200. package/queries/catalog/signature-query/signature-query-format.js +76 -0
  201. package/queries/catalog/signature-query/signature-query-render.d.ts +15 -0
  202. package/queries/catalog/signature-query/signature-query-render.js +155 -0
  203. package/queries/catalog/static-slice-query/static-slice-query-executor.js +9 -3
  204. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +10 -0
  205. package/queries/catalog/static-slice-query/static-slice-query-format.js +19 -1
  206. package/queries/query-print.js +5 -0
  207. package/queries/query.d.ts +15 -5
  208. package/queries/query.js +7 -4
  209. package/r-bridge/init.js +5 -1
  210. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +10 -0
  211. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +55 -0
  212. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +16 -0
  213. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +27 -0
  214. package/r-bridge/lang-4.x/ast/parser/json/format.js +89 -2
  215. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.js +2 -4
  216. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +2 -1
  217. package/r-bridge/parser.d.ts +2 -0
  218. package/r-bridge/retriever.js +4 -1
  219. package/r-bridge/roxygen2/documentation-provider.js +2 -1
  220. package/r-bridge/shell.d.ts +5 -0
  221. package/r-bridge/shell.js +17 -1
  222. package/reconstruct/inline/source-inline-map.d.ts +48 -0
  223. package/reconstruct/inline/source-inline-map.js +94 -0
  224. package/reconstruct/reconstruct.d.ts +19 -2
  225. package/reconstruct/reconstruct.js +79 -16
  226. package/search/search-executor/search-generators.js +5 -22
  227. package/search/search-executor/search-transformer.js +10 -6
  228. package/slicing/criterion/parse.d.ts +28 -4
  229. package/slicing/criterion/parse.js +133 -18
  230. package/slicing/static/slice-call.d.ts +24 -1
  231. package/slicing/static/slice-call.js +90 -0
  232. package/slicing/static/static-slicer.d.ts +7 -0
  233. package/slicing/static/static-slicer.js +38 -3
  234. package/util/collections/arrays.d.ts +4 -5
  235. package/util/collections/arrays.js +7 -18
  236. package/util/hash.d.ts +14 -0
  237. package/util/hash.js +31 -0
  238. package/util/mermaid/dfg.d.ts +7 -2
  239. package/util/mermaid/dfg.js +53 -13
  240. package/util/r-base-packages.d.ts +19 -0
  241. package/util/r-base-packages.js +72 -0
  242. package/util/r-license.js +2 -10
  243. package/util/r-version.d.ts +45 -15
  244. package/util/r-version.js +97 -36
  245. package/util/range.d.ts +15 -0
  246. package/util/range.js +39 -0
  247. package/util/schema.d.ts +10 -0
  248. package/util/schema.js +22 -0
  249. package/util/text/ansi.d.ts +3 -0
  250. package/util/text/ansi.js +10 -0
  251. package/util/text/args.js +1 -2
  252. package/util/version.js +28 -8
  253. package/data/pkgdb/pkgdb-latest.json.br +0 -0
  254. package/data/pkgdb/pkgdb-tiny.json.br +0 -0
  255. package/documentation/wiki-package-database.d.ts +0 -9
  256. package/documentation/wiki-package-database.js +0 -63
  257. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +0 -63
  258. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +0 -176
  259. package/project/plugins/package-version-plugins/pkgdb.d.ts +0 -133
  260. package/project/plugins/package-version-plugins/pkgdb.js +0 -370
  261. package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +0 -6
  262. package/queries/catalog/df-shape-query/df-shape-query-executor.js +0 -58
  263. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +0 -27
  264. package/queries/catalog/df-shape-query/df-shape-query-format.js +0 -56
@@ -1,9 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.processAsNamedCall = processAsNamedCall;
4
+ exports.processChainedCall = processChainedCall;
4
5
  const named_call_handling_1 = require("./functions/call/named-call-handling");
5
6
  const make_argument_1 = require("./functions/call/argument/make-argument");
7
+ const process_argument_1 = require("./functions/process-argument");
6
8
  const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
9
+ const r_function_call_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
10
+ const r_argument_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
11
+ const assert_1 = require("../../../util/assert");
7
12
  /**
8
13
  * Helper function for {@link processNamedCall} using the given `functionName` as the name of the function.
9
14
  */
@@ -16,4 +21,93 @@ function processAsNamedCall({ info, lexeme, location }, data, name, args) {
16
21
  location,
17
22
  }, (0, make_argument_1.wrapArgumentsUnnamed)(args, data.completeAst.idMap), info.id, data);
18
23
  }
24
+ function isBinaryOpOrPipe(node) {
25
+ return node.type === type_1.RType.BinaryOp || node.type === type_1.RType.Pipe;
26
+ }
27
+ function isInfixSpecialCall(node) {
28
+ return node.type === type_1.RType.FunctionCall && node.named === true && node.infixSpecial === true && node.arguments.length === 2;
29
+ }
30
+ function isChainNode(node) {
31
+ return node !== undefined && (isBinaryOpOrPipe(node) || isInfixSpecialCall(node));
32
+ }
33
+ /**
34
+ * The raw (unwrapped) left operand of a chain node, used to detect whether the chain continues.
35
+ * <p>
36
+ * Unlike {@link RType#BinaryOp}, whose `lhs` is the raw operand, both parser backends always pre-wrap a
37
+ * {@link RType#Pipe}'s `lhs` (and an infix-special {@link RType#FunctionCall}'s first argument) as an
38
+ * {@link RArgument}, so those need unwrapping via `.value` first.
39
+ */
40
+ function chainLhsRaw(node) {
41
+ if (node.type === type_1.RType.FunctionCall) {
42
+ const arg = node.arguments[0];
43
+ return arg === r_function_call_1.EmptyArgument ? undefined : arg.value;
44
+ }
45
+ return r_argument_1.RArgument.is(node.lhs) ? node.lhs.value : node.lhs;
46
+ }
47
+ /** The left operand of a chain node, wrapped as the {@link RArgument} that {@link processAllArguments} would process it as. */
48
+ function chainLhsArgument(node, idMap) {
49
+ if (node.type === type_1.RType.FunctionCall) {
50
+ const arg = node.arguments[0];
51
+ (0, assert_1.guard)(arg !== r_function_call_1.EmptyArgument, 'an infix-special call always has a non-empty first argument');
52
+ return arg;
53
+ }
54
+ if (r_argument_1.RArgument.is(node.lhs)) {
55
+ return node.lhs;
56
+ }
57
+ const wrapped = (0, make_argument_1.toUnnamedArgument)(node.lhs, idMap);
58
+ (0, assert_1.guard)(wrapped !== r_function_call_1.EmptyArgument, 'the lhs of a binary operator is never empty');
59
+ return wrapped;
60
+ }
61
+ /**
62
+ * Processes a single chain node (see {@link ChainNode}), recursing normally into its children. A caller folding
63
+ * a whole chain (see {@link processChainedCall}) may pass an already-processed left operand via
64
+ * `data.precomputedFirstArg` (keyed by `node.info.id`) to avoid recursing into it again.
65
+ */
66
+ function processSingleChainNode(node, data) {
67
+ if (node.type === type_1.RType.FunctionCall) {
68
+ return (0, named_call_handling_1.processNamedCall)(node.functionName, node.arguments, node.info.id, data);
69
+ }
70
+ const { info, lexeme, location, lhs, rhs } = node;
71
+ return (0, named_call_handling_1.processNamedCall)({
72
+ type: type_1.RType.Symbol,
73
+ info,
74
+ content: node.type === type_1.RType.Pipe ? lexeme : node.operator,
75
+ lexeme,
76
+ location,
77
+ }, (0, make_argument_1.wrapArgumentsUnnamed)([lhs, rhs], data.completeAst.idMap), info.id, data);
78
+ }
79
+ /**
80
+ * Processes a {@link ChainNode}: {@link RType#BinaryOp}, {@link RType#Pipe}, and magrittr-style `%op%` calls
81
+ * (infix-special {@link RType#FunctionCall}s) all nest on their left operand, so a long `a + b + c + ...` or
82
+ * `a %>% f() %>% f() %>% ...` chain buries it arbitrarily deep.
83
+ * This walks the left spine of chain nodes with an explicit loop (bounded stack usage regardless of
84
+ * chain length), processes the innermost (leftmost) node normally, and then folds outward: each level's left
85
+ * operand is wrapped via {@link processFunctionArgument}.
86
+ */
87
+ function processChainedCall(node, data) {
88
+ if (!isChainNode(chainLhsRaw(node))) {
89
+ return processSingleChainNode(node, data);
90
+ }
91
+ const spine = [node];
92
+ let cur = chainLhsRaw(node);
93
+ while (true) {
94
+ spine.push(cur);
95
+ const next = chainLhsRaw(cur);
96
+ if (!isChainNode(next)) {
97
+ break;
98
+ }
99
+ cur = next;
100
+ }
101
+ // process the innermost (leftmost) node normally, then fold outward through the rest of the spine
102
+ let result = processSingleChainNode(spine[spine.length - 1], data);
103
+ for (let i = spine.length - 2; i >= 0; i--) {
104
+ const level = spine[i];
105
+ const lhsRaw = chainLhsRaw(level);
106
+ (0, assert_1.guard)(lhsRaw !== undefined, 'a chain node always has a left operand');
107
+ const wrappedLhs = chainLhsArgument(level, data.completeAst.idMap);
108
+ const lhsInfo = (0, process_argument_1.processFunctionArgument)(wrappedLhs, { ...data, precomputedValue: { nodeId: lhsRaw.info.id, info: result } });
109
+ result = processSingleChainNode(level, { ...data, precomputedFirstArg: { rootId: level.info.id, info: lhsInfo } });
110
+ }
111
+ return result;
112
+ }
19
113
  //# sourceMappingURL=process-named-call.js.map
@@ -41,6 +41,24 @@ export interface DataflowProcessorInformation<OtherInfo> {
41
41
  * so its vertex needs no environment snapshot (it would be discarded by markAsOnlyBuiltIn anyway).
42
42
  */
43
43
  readonly builtInNoEnv?: NodeId;
44
+ /**
45
+ * Escape hatch for hot recursive paths.
46
+ * When set and its `rootId` matches the function call currently being processed by {@link processAllArguments},
47
+ * its `info` is used as the already-processed first argument instead of processing that argument again.
48
+ */
49
+ readonly precomputedFirstArg?: {
50
+ readonly rootId: NodeId;
51
+ readonly info: DataflowInformation;
52
+ };
53
+ /**
54
+ * Companion to {@link precomputedFirstArg}: when set and its `nodeId` matches the node
55
+ * {@link processFunctionArgument} is about to process as an argument's value, its `info` is used instead of
56
+ * processing (and recursing into) that node again. This allows to separate arg wrappers from their content!
57
+ */
58
+ readonly precomputedValue?: {
59
+ readonly nodeId: NodeId;
60
+ readonly info: DataflowInformation;
61
+ };
44
62
  }
45
63
  export type DataflowProcessor<OtherInfo, NodeType extends RNodeWithParent<OtherInfo>> = (node: NodeType, data: DataflowProcessorInformation<OtherInfo>) => DataflowInformation;
46
64
  type NodeWithKey<OtherInfo, Key> = RNode<OtherInfo & ParentInformation> & {
@@ -15,6 +15,10 @@ function registerFaqs(ctx) {
15
15
  Tests are labeled based on the *flowR* capabilities that they test for.
16
16
  The list of supported capabilities can be found on the ${ctx.linkPage('wiki/Capabilities', 'Capabilities')} wiki page.
17
17
  For more extensive information on test labels, see the ${ctx.linkPage('wiki/Linting and Testing', 'test labels wiki section', 'test-labels')}.
18
+ `)
19
+ .addFaq('How do I run *all checks* before pushing?', `
20
+ Run \`npm run checkup\`: it runs the linter, the functionality and system tests, the wiki generation, and the docker image build + smoke test concurrently, then prints one pass/fail summary.
21
+ Run a subset with the job ids (e.g. \`npm run checkup -- lint tests\`) or skip the container build with \`npm run checkup -- --no-docker\`.
18
22
  `)
19
23
  .addFaq('How to get a REPL with debug-info/*hot-reload*?', `
20
24
  To enter the development repl, execute \`npm run main-dev\` in contrast to \`npm run flowr\`
@@ -95,7 +99,7 @@ or [rdocumentation.org](https://rdocumentation.org/). Additionally, the package
95
99
  be downloaded directly from [cran](https://cran.r-project.org/).
96
100
  `)
97
101
  .addFaq('How does flowR know a *package\'s exports*?', `
98
- See the ${ctx.linkPage('wiki/Package Database', 'Package Database')} wiki page.
102
+ See the ${ctx.linkPage('wiki/Signature Database', 'Signature Database')} wiki page.
99
103
  `);
100
104
  wikiFaq.withTopic('editor.configs')
101
105
  .addFaq('How can I make eslint and ZED work together?', `Use this project config (\`.zed/settings.json\`) to disable all formatters except eslint:
@@ -58,7 +58,7 @@ function getTestDetails(info, capability) {
58
58
  grouped.delete('output');
59
59
  const testString = [`${uniqueTests.length} test${uniqueTests.length !== 1 ? 's' : ''}`];
60
60
  // sort by count
61
- const sorted = [...grouped.entries()].sort((a, b) => b[1] - a[1]);
61
+ const sorted = [...grouped.entries()].sort((a, b) => b[0].localeCompare(a[0]));
62
62
  for (const [context, count] of sorted) {
63
63
  testString.push(`${context}: ${count}`);
64
64
  }
@@ -2,6 +2,8 @@
2
2
  import { scripts } from '../../cli/common/scripts-info';
3
3
  import { flowrMainOptionDefinitions } from '../../cli/flowr-main-options';
4
4
  import type { ReplCommandNames } from '../../cli/repl/commands/repl-commands';
5
+ import { FlowrConfig } from '../../config';
6
+ import type { AutocompletablePaths } from '../../util/objects';
5
7
  export type ScriptOptions<Type extends keyof typeof scripts | 'flowr'> = Type extends keyof typeof scripts ? typeof scripts[Type]['options'][number]['name'] : Type extends 'flowr' ? typeof flowrMainOptionDefinitions[number]['name'] : never;
6
8
  /**
7
9
  * Produce the documentation string for a CLI long option
@@ -11,6 +13,14 @@ export declare function getCliLongOptionOf<ScriptName extends keyof typeof scrip
11
13
  * Produce the documentation string for multiple CLI long options
12
14
  */
13
15
  export declare function multipleCliOptions<ScriptName extends keyof typeof scripts | 'flowr', OptionName extends ScriptOptions<ScriptName>>(scriptName: ScriptName, ...options: OptionName[]): string;
16
+ /**
17
+ * Produce a documentation link for a flowR configuration option (e.g. `solver.sigdb.enabled`).
18
+ * The link points at the configuration section of the Interface wiki page and carries the option's
19
+ * schema type, description, and any enumerated values as a hover tooltip.
20
+ * @param path - The (autocompleted) `.`-separated configuration path.
21
+ * @param quote - Whether to render the path as inline code. Default is `true`.
22
+ */
23
+ export declare function getConfigOption(path: AutocompletablePaths<FlowrConfig>, quote?: boolean): string;
14
24
  /**
15
25
  * Produce the documentation string for a REPL command
16
26
  */
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCliLongOptionOf = getCliLongOptionOf;
4
4
  exports.multipleCliOptions = multipleCliOptions;
5
+ exports.getConfigOption = getConfigOption;
5
6
  exports.getReplCommand = getReplCommand;
6
7
  /** Automatically provides hover over with the documentation for these! */
7
8
  const scripts_info_1 = require("../../cli/common/scripts-info");
@@ -10,6 +11,9 @@ const html_hover_over_1 = require("../../util/html-hover-over");
10
11
  const flowr_main_options_1 = require("../../cli/flowr-main-options");
11
12
  const repl_commands_1 = require("../../cli/repl/commands/repl-commands");
12
13
  const doc_escape_1 = require("./doc-escape");
14
+ const config_1 = require("../../config");
15
+ const schema_1 = require("../../util/schema");
16
+ const doc_files_1 = require("./doc-files");
13
17
  /**
14
18
  * Produce the documentation string for a CLI long option
15
19
  */
@@ -31,6 +35,25 @@ function getCliLongOptionOf(scriptName, optionName, withAlias = false, quote = t
31
35
  function multipleCliOptions(scriptName, ...options) {
32
36
  return options.map(o => getCliLongOptionOf(scriptName, o, false, true)).join(' ');
33
37
  }
38
+ /**
39
+ * Produce a documentation link for a flowR configuration option (e.g. `solver.sigdb.enabled`).
40
+ * The link points at the configuration section of the Interface wiki page and carries the option's
41
+ * schema type, description, and any enumerated values as a hover tooltip.
42
+ * @param path - The (autocompleted) `.`-separated configuration path.
43
+ * @param quote - Whether to render the path as inline code. Default is `true`.
44
+ */
45
+ function getConfigOption(path, quote = true) {
46
+ const info = (0, schema_1.schemaPathInfo)(config_1.FlowrConfig.Schema, path.split('.'));
47
+ let tooltip = `Configuration Option (${info.type ?? 'option'})`;
48
+ if (info.description) {
49
+ tooltip += `: ${info.description}`;
50
+ }
51
+ if (info.valids && info.valids.length > 0) {
52
+ tooltip += ` (one of ${info.valids.map(v => JSON.stringify(v)).join(', ')})`;
53
+ }
54
+ const label = quote ? `<code>${(0, doc_escape_1.escapeHTML)(path)}</code>` : (0, doc_escape_1.escapeHTML)(path);
55
+ return `<a href="${doc_files_1.FlowrWikiBaseRef}/Interface#configuring-flowr" title=${JSON.stringify((0, doc_escape_1.escapeHTML)(tooltip))}>${label}</a>`;
56
+ }
34
57
  /**
35
58
  * Produce the documentation string for a REPL command
36
59
  */
@@ -52,7 +52,8 @@ async function printDfGraphForCode(parser, code, { callGraph = false, simplified
52
52
  if (switchCodeAndGraph) {
53
53
  (0, assert_1.guard)(showCode, 'can not switch code and graph if code is not shown');
54
54
  }
55
- const metaInfo = `The analysis required _${(0, time_1.printAsMs)(duration)}_ (including parse and normalize, using the ${ctx ? ctx.linkPage('wiki/Engines', parser.name) : `[${parser.name}](${doc_files_1.FlowrWikiBaseRef}/Engines)`} engine) within the generation environment.`;
55
+ const sigDbNote = `No ${ctx ? ctx.linkPage('wiki/Signature Database', 'signature database') : `[signature database](${doc_files_1.FlowrWikiBaseRef}/Signature-Database)`} is mounted for these generated graphs, so \`library()\` calls attach no package exports; base-R names are still qualified via the generated base-package store (e.g. \`acf\` as \`stats::acf\`).`;
56
+ const metaInfo = `The analysis required _${(0, time_1.printAsMs)(duration)}_ (including parse and normalize, using the ${ctx ? ctx.linkPage('wiki/Engines', parser.name) : `[${parser.name}](${doc_files_1.FlowrWikiBaseRef}/Engines)`} engine) within the generation environment. ${sigDbNote}`;
56
57
  const graph = callGraph ? call_graph_1.CallGraph.compute(result.dataflow.graph) : result.dataflow.graph;
57
58
  const dfGraph = printDfGraph(graph, mark, simplified);
58
59
  const simplyText = simplified ? '(simplified) ' : '';
@@ -11,11 +11,16 @@ export interface ShowQueryOptions {
11
11
  readonly collapseQuery?: boolean;
12
12
  readonly shorthand?: string;
13
13
  readonly ctx?: GeneralDocContext;
14
+ /** additional in-memory files registered before the request, e.g. the targets of `source(...)` calls */
15
+ readonly files?: readonly {
16
+ readonly name: string;
17
+ readonly content: string;
18
+ }[];
14
19
  }
15
20
  /**
16
21
  * Visualizes a query and its results in markdown format.
17
22
  */
18
- export declare function showQuery<Base extends SupportedQueryTypes, VirtualArguments extends VirtualCompoundConstraint<Base> = VirtualCompoundConstraint<Base>>(parser: KnownParser, code: string, queries: Queries<Base, VirtualArguments>, { showCode, collapseResult, collapseQuery, shorthand, ctx }?: ShowQueryOptions): Promise<string>;
23
+ export declare function showQuery<Base extends SupportedQueryTypes, VirtualArguments extends VirtualCompoundConstraint<Base> = VirtualCompoundConstraint<Base>>(parser: KnownParser, code: string, queries: Queries<Base, VirtualArguments>, { showCode, collapseResult, collapseQuery, shorthand, ctx, files }?: ShowQueryOptions): Promise<string>;
19
24
  export interface QueryDocumentation {
20
25
  readonly name: string;
21
26
  readonly type: 'virtual' | 'active';
@@ -34,9 +39,10 @@ export declare const RegisteredQueries: {
34
39
  */
35
40
  export declare function registerQueryDocumentation(query: SupportedQueryTypes | SupportedVirtualQueryTypes, doc: QueryDocumentation): void;
36
41
  /**
37
- * Creates a REPL shorthand for the given slicing criteria and R code.
42
+ * Creates a REPL shorthand for the given slicing criteria and R code (`f` requests a forward slice,
43
+ * `i` inlines resolvable `source()` calls into the reconstruction; the flags may be combined as `fi`).
38
44
  */
39
- export declare function sliceQueryShorthand(criteria: SlicingCriteria, code: string, forward?: boolean): string;
45
+ export declare function sliceQueryShorthand(criteria: SlicingCriteria, code: string, forward?: boolean, inline?: boolean): string;
40
46
  /**
41
47
  *
42
48
  */
@@ -15,13 +15,17 @@ const doc_code_1 = require("./doc-code");
15
15
  const time_1 = require("../../util/text/time");
16
16
  const query_print_1 = require("../../queries/query-print");
17
17
  const flowr_analyzer_builder_1 = require("../../project/flowr-analyzer-builder");
18
+ const flowr_file_1 = require("../../project/context/flowr-file");
18
19
  const doc_cli_option_1 = require("./doc-cli-option");
19
20
  /**
20
21
  * Visualizes a query and its results in markdown format.
21
22
  */
22
- async function showQuery(parser, code, queries, { showCode, collapseResult, collapseQuery, shorthand, ctx } = {}) {
23
+ async function showQuery(parser, code, queries, { showCode, collapseResult, collapseQuery, shorthand, ctx, files } = {}) {
23
24
  const now = performance.now();
24
25
  const analyzer = await new flowr_analyzer_builder_1.FlowrAnalyzerBuilder().setParser(parser).build();
26
+ for (const file of files ?? []) {
27
+ analyzer.addFile(new flowr_file_1.FlowrInlineTextFile(file.name, file.content));
28
+ }
25
29
  analyzer.addRequest(code);
26
30
  const results = await analyzer.query(queries);
27
31
  const duration = performance.now() - now;
@@ -86,10 +90,11 @@ function registerQueryDocumentation(query, doc) {
86
90
  map.set(query, doc);
87
91
  }
88
92
  /**
89
- * Creates a REPL shorthand for the given slicing criteria and R code.
93
+ * Creates a REPL shorthand for the given slicing criteria and R code (`f` requests a forward slice,
94
+ * `i` inlines resolvable `source()` calls into the reconstruction; the flags may be combined as `fi`).
90
95
  */
91
- function sliceQueryShorthand(criteria, code, forward) {
92
- return `(${(criteria.join(';'))})${forward ? 'f' : ''} "${code}"`;
96
+ function sliceQueryShorthand(criteria, code, forward, inline) {
97
+ return `(${(criteria.join(';'))})${forward ? 'f' : ''}${inline ? 'i' : ''} "${code}"`;
93
98
  }
94
99
  function linkify(name) {
95
100
  return name.toLowerCase().replace(/ /g, '-');
@@ -185,9 +185,11 @@ ${(0, doc_structure_1.block)({
185
185
  type: vertex_1.VertexType.FunctionCall,
186
186
  description: `
187
187
  Describes any kind of function call, including unnamed calls and those that happen implicitly!
188
- In general the vertex provides you with information about
188
+ In general the vertex provides you with information about
189
189
  the _name_ of the called function, the passed _arguments_, and the _environment_ in which the call happens (if it is of importance).
190
190
 
191
+ Whenever flowR can determine which package a call resolves to &mdash; via a loaded \`library()\`/\`::\`, or via the always-available base-R packages taken from the ${ctx.linkPage('wiki/Signature Database', 'signature database')} &mdash; the mermaid visualization prints the **package-qualified name** in place of the bare one (e.g. \`acf\` is shown as \`stats::acf\`). To obtain this qualified identifier programmatically from a call's origins, use \`Identifier.toQualified\` (see the \`origin\` property below and the ${ctx.linkPage('wiki/Signature Database', 'signature database')} for where the base-R knowledge comes from).
192
+
191
193
  However, the implementation reveals that it may hold an additional \`onlyBuiltin\` flag to indicate that the call is only calling builtin functions &mdash; however, this is only a flag to improve performance,
192
194
  and it should not be relied on as it may under-approximate the actual calling targets (e.g., being \`false\` even though all calls resolve to builtins).
193
195
 
@@ -481,7 +483,7 @@ ${(0, doc_structure_1.details)('Example: Parameters of a Function', await (async
481
483
  const code = 'f <- function(x, y = 3) x + y';
482
484
  const [text, info] = await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { mark: new Set([10, 1, 3]), exposeResult: true, ctx });
483
485
  const ast = await (0, doc_normalized_ast_1.printNormalizedAstForCode)(parser, code, { prefix: 'flowchart LR\n', showCode: false, ctx });
484
- const functionDefinition = [...info.dataflow.graph.vertices(true)].find(([, vertex]) => vertex.tag === vertex_1.VertexType.FunctionDefinition);
486
+ const functionDefinition = info.dataflow.graph.vertices(true).find(([, vertex]) => vertex.tag === vertex_1.VertexType.FunctionDefinition);
485
487
  (0, assert_1.guard)(functionDefinition !== undefined, () => `Could not find function definition for ${code}`);
486
488
  const [id] = functionDefinition;
487
489
  const normalized = info.normalize.idMap.get(id);
@@ -861,11 +863,12 @@ ${(0, doc_structure_1.section)('Lexeme', 3, 'vtx-lexeme')}
861
863
 
862
864
  Also in the first line, next to the [syntactic type](#vtx-synt-type), you can find the lexeme of the vertex (if it has one, e.g., for a variable definition or use).
863
865
  This usually represents the textual source string of the respective vertex, and is also linked to the ${ctx.linkPage('wiki/Normalized AST')}.
866
+ For a clearer hierarchy, the lexeme is rendered in **bold** while the [syntactic type](#vtx-synt-type) is de-emphasized in _italics_ (mermaid markdown labels do not support a per-token font color, so a true gray tone would require styling the whole node). Only the token the source actually wrote is bold: when a call is shown with a package-qualified name that flowR *added* (e.g. the code wrote \`acf\` but it is displayed as \`stats::acf\`), the added \`stats::\` prefix stays non-bold, whereas a namespace written verbatim in the source is part of the lexeme and is bold as a whole.
864
867
  You can access the lexeme too with ${ctx.linkO(model_1.RNode, 'lexeme')}.
865
868
 
866
869
  ${(0, doc_structure_1.section)('Vertex Id', 3, 'vtx-id')}
867
870
 
868
- In the second line, you will usually find the id (in the form of a ${ctx.link(node_id_1.NodeId, undefined, { type: 'variable' })}) of the vertex,
871
+ In the second line, you will usually find the id (in the form of a ${ctx.link(node_id_1.NodeId, undefined, { type: 'variable' })}) of the vertex &mdash; kept compact by sharing the line with the [location](#vtx-location), in the form \`*location* (**id: <id>**)\` with the id in **bold** &mdash;
869
872
  alongside its [control dependencies](#control-dependencies) if it has any. This id links the vertex to the respective node in the ${ctx.linkPage('wiki/Normalized AST')} (and all other perspectives created by flowR).
870
873
  To give you an example, have a look at the following graph:
871
874
 
@@ -875,7 +878,7 @@ on the \`if\`, which only triggers when the condition is \`true\` (as indicated
875
878
 
876
879
  ${(0, doc_structure_1.section)('Location', 3, 'vtx-location')}
877
880
 
878
- The third line indicates the compressed ${ctx.link(range_1.SourceRange)} of the vertex in the format \`startLine.startCharacter - endLine.endCharacter\`. If the range reads \`1.7\`,
881
+ The second line also indicates the compressed ${ctx.link(range_1.SourceRange)} of the vertex (directly before the [id](#vtx-id)) in the format \`startLine.startCharacter - endLine.endCharacter\`. If the range reads \`1.7\`,
879
882
  this is short for \`1.7-1.7\`, likewise, \`1.7-9\` is short for \`1.7-1.9\`. So, \`1.7-9\` describes something starting
880
883
  in the first line at the seventh character and ending in the first line at the ninth character.
881
884
 
@@ -883,7 +886,7 @@ ${(0, doc_structure_1.section)('Arguments and Additional Information', 3, 'vtx-a
883
886
 
884
887
  Some vertices (e.g., [function calls](#function-call-vertex)) have additional information, like the arguments of the call.
885
888
  As you can see with the \`if\` example above alongside the [vertex id](#vtx-id),
886
- these vertices also have an additional line which lists the ids of the arguments in order to clear any ambiguity in case, for example,
889
+ these vertices also have an additional line (prefixed with \`arg:\`) which lists the ids of the arguments in order to clear any ambiguity in case, for example,
887
890
  the mermaid graph layouting fumbles the order.
888
891
 
889
892
  ${(0, doc_structure_1.section)('Vertices', 2, 'vertices')}
@@ -161,6 +161,7 @@ ${await (0, doc_repl_1.documentReplSession)(parser, [{
161
161
  }], { openOutput: true })}
162
162
 
163
163
  For the slicing with ${ctx.replCmd('slicer')}, you have access to the same [magic comments](#slice-magic-comments) as with the [slice request](#message-request-slice).
164
+ Pass \`--inline\` to splice resolvable \`source()\` calls into the reconstruction so the slice is a single self-contained R text (the same as the static slice query's \`inlineSources\` flag).
164
165
 
165
166
  ### Example: Interfacing with the File System
166
167
 
@@ -194,7 +195,7 @@ As _flowR_ directly transforms this AST the output focuses on being human-readab
194
195
  You can run any query supported by _flowR_ using the ${ctx.replCmd('query')} command.
195
196
  For example, to obtain the shapes of all data frames in a given piece of code, you can run:
196
197
  ${await (0, doc_repl_1.documentReplSession)(parser, [{
197
- command: ':query @df-shape "x <- data.frame(a = 1:10, b = 1:10)\\ny <- x$a"',
198
+ command: ':query @absint df-shape "x <- data.frame(a = 1:10, b = 1:10)\\ny <- x$a"',
198
199
  description: 'Retrieve the shapes of all data frames in the given code.'
199
200
  }], { openOutput: true })}
200
201
  To run the linter on a file, you can use (in this example, we just issue the \`dead-code\` linter on a small piece of code):
@@ -253,6 +254,7 @@ ${(0, doc_code_1.codeBlock)('json', JSON.stringify({
253
254
  repl: {
254
255
  quickStats: false,
255
256
  dfProcessorHeat: false,
257
+ hints: true,
256
258
  plugins: ['flowr:default']
257
259
  },
258
260
  project: {
@@ -263,7 +265,7 @@ ${(0, doc_code_1.codeBlock)('json', JSON.stringify({
263
265
  variables: config_1.VariableResolve.Alias,
264
266
  evalStrings: true,
265
267
  trackEnvironments: true,
266
- pkgdb: { enabled: true, eagerlyLoad: false, eagerlyLoadExports: false },
268
+ sigdb: { enabled: true, loadProjectDependencies: true, eagerlyLoad: false, eagerlyLoadExports: false, linkBaseR: false, linkDescriptionDependencies: false },
267
269
  resolveSource: {
268
270
  dropPaths: config_1.DropPathsOption.No,
269
271
  ignoreCapitalization: true,
@@ -210,7 +210,7 @@ async function getTextMainPage(knownParser, tagTypes, ctx) {
210
210
  const rules = registerRules(knownParser, tagTypes.info);
211
211
  return `
212
212
  This page describes the flowR linter, which is a tool that utilizes flowR's dataflow analysis to find common issues in R scripts. The linter can currently be used through the linter ${ctx.linkPage('wiki/Query API', 'query')}.
213
- Some rules also draw on the ${ctx.linkPage('wiki/Package Database', 'package database')}.
213
+ Some rules also draw on the ${ctx.linkPage('wiki/Signature Database', 'signature database')}.
214
214
  For example:
215
215
 
216
216
  ${await (async () => {
@@ -43,8 +43,11 @@ for the latest benchmark results, see the [benchmark results](${doc_files_1.Flow
43
43
 
44
44
  Currently, flowR contains three testing suites: one for [functionality](#functionality-tests),
45
45
  one for [system tests](#system-tests), and one for [performance](#performance-tests). We explain each of them in the following.
46
- In addition to running those tests, you can use the more generalized \`npm run checkup\`.
46
+ In addition to running those tests, you can use the more generalized \`npm run checkup\`.
47
47
  This command includes the construction of the docker image, the generation of the wiki pages, and the linter.
48
+ It runs these jobs concurrently but caps the test workers so the combined run fits the machine (it splits the
49
+ available cores across the parallel \`vitest\` jobs via \`--maxWorkers\` instead of letting each grab every core).
50
+ Pass job ids to run a subset (e.g. \`npm run checkup -- lint tests\`) or \`--no-docker\` to skip the image build.
48
51
 
49
52
  <a id='functionality-tests'></a>
50
53
  ### 🧪 Functionality Tests
@@ -4,6 +4,8 @@ import type { ValidWikiDocumentTargetsNoSuffix } from '../../cli/wiki';
4
4
  import type { PathLike } from 'fs';
5
5
  import type { scripts } from '../../cli/common/scripts-info';
6
6
  import type { ScriptOptions } from '../doc-util/doc-cli-option';
7
+ import type { FlowrConfig } from '../../config';
8
+ import type { AutocompletablePaths } from '../../util/objects';
7
9
  import type { ReplCommandNames } from '../../cli/repl/commands/repl-commands';
8
10
  /**
9
11
  * Context available when generating documentation for a wiki in markdown format
@@ -311,6 +313,18 @@ export interface GeneralDocContext {
311
313
  * @see {@link getReplCommand} - for the underlying impl.
312
314
  */
313
315
  replCmd(commandName: ReplCommandNames, quote?: boolean, showStar?: boolean): string;
316
+ /**
317
+ * Generates a link to a flowR configuration option, resolving its schema type and description as a hover tooltip.
318
+ * @example
319
+ * ```ts
320
+ * linkConfig('solver.sigdb.enabled')
321
+ * ```
322
+ * Returns a link to the configuration section of the Interface wiki page, showing `solver.sigdb.enabled` with its documentation on hover.
323
+ * @param path - The `.`-separated configuration path (autocompletes to valid config keys only).
324
+ * @param quote - Whether to render the path as inline code. Default is `false`.
325
+ * @see {@link getConfigOption} - for the underlying impl.
326
+ */
327
+ linkConfig<K extends AutocompletablePaths<FlowrConfig>>(path: K, quote?: boolean): string;
314
328
  }
315
329
  /**
316
330
  * Creates a wiki context for generating documentation for code elements.
@@ -136,6 +136,9 @@ function makeDocContextForTypes(shell, ...rootFolders) {
136
136
  },
137
137
  replCmd(commandName, quote = true, showStar = false) {
138
138
  return (0, doc_cli_option_1.getReplCommand)(commandName, quote, showStar);
139
+ },
140
+ linkConfig(path, quote = false) {
141
+ return (0, doc_cli_option_1.getConfigOption)(path, quote);
139
142
  }
140
143
  };
141
144
  }
@@ -26,7 +26,9 @@ const DefaultReplacementPatterns = [
26
26
  [/%2Fhome%2F([a-zA-Z0-9._-]+%2F)*/g, ''],
27
27
  // async wrapper depends on whether the promise got fulfilled already
28
28
  [/async|%20/g, ''],
29
- [/\s*Copied mermaid url to clipboard\s*\([^)]+\)/gmi, '']
29
+ [/\s*Copied mermaid url to clipboard\s*\([^)]+\)/gmi, ''],
30
+ // mute signature database load time variance in wiki table
31
+ [/≈\s*<?[\d.]+\s*[µm]s/g, '']
30
32
  ];
31
33
  /**
32
34
  * Abstract base class for generating wiki files.
@@ -28,7 +28,6 @@ const flowr_search_builder_1 = require("../search/flowr-search-builder");
28
28
  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
- const df_shape_query_executor_1 = require("../queries/catalog/df-shape-query/df-shape-query-executor");
32
31
  const doc_repl_1 = require("./doc-util/doc-repl");
33
32
  const inspect_higher_order_query_executor_1 = require("../queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor");
34
33
  const doc_escape_1 = require("./doc-util/doc-escape");
@@ -41,6 +40,7 @@ const inspect_exception_query_executor_1 = require("../queries/catalog/inspect-e
41
40
  const slice_direction_1 = require("../util/slice-direction");
42
41
  const provenance_query_executor_1 = require("../queries/catalog/provenance-query/provenance-query-executor");
43
42
  const input_sources_query_executor_1 = require("../queries/catalog/input-sources-query/input-sources-query-executor");
43
+ const absint_query_executor_1 = require("../queries/catalog/absint-query/absint-query-executor");
44
44
  (0, doc_query_1.registerQueryDocumentation)('call-context', {
45
45
  name: 'Call-Context Query',
46
46
  type: 'active',
@@ -462,26 +462,29 @@ enables quick statistics after each REPL command. Likewise, setting \`repl.dfPro
462
462
  `;
463
463
  }
464
464
  });
465
- (0, doc_query_1.registerQueryDocumentation)('df-shape', {
466
- name: 'Dataframe Shape Inference Query',
465
+ (0, doc_query_1.registerQueryDocumentation)('absint', {
466
+ name: 'Abstract Interpretation Query',
467
467
  type: 'active',
468
- shortDescription: 'Returns the shapes inferred for all dataframes in the code.',
469
- functionName: df_shape_query_executor_1.executeDfShapeQuery.name,
470
- functionFile: '../queries/catalog/df-shape-query/df-shape-query-format.ts',
468
+ shortDescription: 'Returns the abstract values inferred for every expression or at specific locations.',
469
+ functionName: absint_query_executor_1.executeAbsintQuery.name,
470
+ functionFile: '../queries/catalog/absint-query/absint-query-format.ts',
471
471
  buildExplanation: async (shell, ctx) => {
472
- const exampleCode = 'x <- data.frame(a=1:3)\nfilter(x, FALSE)';
473
- const criterion = '2@x';
472
+ const criteria = ['1@df', '1@data.frame'];
473
+ const inference = 'df-shape';
474
+ const exampleCode = 'df <- data.frame(id = 1:3) |>\n filter(df, FALSE)';
474
475
  return `
475
- This query infers all shapes of dataframes within the code. For example, you can use:
476
+ This query infers all shapes of dataframes within the code using abstract interpretaion. For example, you can use:
476
477
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
477
- type: 'df-shape'
478
+ type: 'absint',
479
+ inference: inference
478
480
  }], { showCode: true, collapseQuery: true, ctx })}
479
481
 
480
- The query also accepts an optional slice criterion to narrow the results to a specific node. For example:
482
+ The query optionally also accepts slice criteria to narrow the results to specific nodes. For example:
481
483
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
482
- type: 'df-shape',
483
- criterion: criterion
484
- }], { showCode: true, collapseQuery: true, shorthand: (0, doc_query_1.sliceQueryShorthand)([criterion], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
484
+ type: 'absint',
485
+ inference: inference,
486
+ criteria: criteria
487
+ }], { showCode: true, collapseQuery: true, shorthand: (0, doc_query_1.sliceQueryShorthand)(criteria, (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
485
488
  `;
486
489
  }
487
490
  });
@@ -548,6 +551,8 @@ Now, the results no longer contain calls to \`plot\` that are not defined locall
548
551
  buildExplanation: async (shell, ctx) => {
549
552
  const exampleCode = 'x <- 1\ny <- 2\nz <- 3\nx';
550
553
  const criteria = ['3@z', '4@x'];
554
+ const sourceExample = 'source("library.R")\nprint(greeting)';
555
+ const sourceCriteria = ['2@print'];
551
556
  return `
552
557
  To slice, _flowR_ needs one thing from you: a variable or a list of variables (function calls are supported to, referring to the anonymous
553
558
  return of the call) that you want to slice the dataflow graph for (additionally, you have to tell flowR if you want to have a forward slice).
@@ -580,6 +585,22 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
580
585
  direction: slice_direction_1.SliceDirection.Forward
581
586
  }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)(['1@x'], (0, doc_escape_1.escapeNewline)(exampleCode), true), ctx })}
582
587
 
588
+ If your program pulls in other files with \`source(...)\`, the \`inlineSources\` flag splices the reconstruction
589
+ of each resolvable sourced file into the place of its \`source()\` call, so the slice becomes a single
590
+ self-contained R text (cyclic or unresolvable \`source()\` calls are kept verbatim and reported via
591
+ \`reconstruct.inlineWarnings\`). With the ${(0, doc_cli_option_1.getReplCommand)('query')} REPL command you append an \`i\` to the
592
+ criteria (and may combine it with the forward \`f\` as \`fi\`), for example (with a faked \`library.R\` providing \`greeting\`):
593
+ ${await (0, doc_query_1.showQuery)(shell, sourceExample, [{
594
+ type: 'static-slice',
595
+ criteria: sourceCriteria,
596
+ inlineSources: true
597
+ }], {
598
+ showCode: false,
599
+ shorthand: (0, doc_query_1.sliceQueryShorthand)(sourceCriteria, (0, doc_escape_1.escapeNewline)(sourceExample), false, true),
600
+ ctx,
601
+ files: [{ name: 'library.R', content: 'greeting <- "hello"\nunused <- 123' }]
602
+ })}
603
+
583
604
  You can disable ${ctx.linkPage('wiki/Interface', 'magic comments', 'slice-magic-comments')} using the \`noMagicComments\` flag.
584
605
  This query replaces the old ${ctx.linkPage('wiki/Interface', '`request-slice`', 'message-request-slice')} message.
585
606
  `;
@@ -660,7 +681,7 @@ print("hello world!")
660
681
  return `
661
682
  This query extracts all dependencies from an R script, using a combination of a ${(0, doc_query_1.linkToQueryOfName)('call-context')}
662
683
  and more advanced tracking in the ${ctx.linkPage('wiki/Dataflow Graph', 'Dataflow Graph')}.
663
- Loaded libraries are resolved against the ${ctx.linkPage('wiki/Package Database', 'package database')}.
684
+ Loaded libraries are resolved against the ${ctx.linkPage('wiki/Signature Database', 'signature database')}.
664
685
 
665
686
  In other words, if you have a script simply reading: \`${exampleCode}\`, the following query returns the loaded library:
666
687
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{