@eagleoutice/flowr 2.10.8 → 2.10.10

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 (260) hide show
  1. package/README.md +106 -36
  2. package/abstract-interpretation/absint-visitor.js +6 -3
  3. package/abstract-interpretation/domains/abstract-domain.d.ts +1 -1
  4. package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -1
  5. package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
  6. package/abstract-interpretation/domains/interval-domain.d.ts +1 -1
  7. package/abstract-interpretation/domains/interval-domain.js +1 -1
  8. package/abstract-interpretation/domains/lattice.d.ts +1 -1
  9. package/abstract-interpretation/domains/partial-product-domain.d.ts +1 -1
  10. package/abstract-interpretation/domains/partial-product-domain.js +2 -2
  11. package/abstract-interpretation/domains/set-range-domain.d.ts +1 -1
  12. package/abstract-interpretation/domains/set-range-domain.js +1 -1
  13. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +1 -1
  14. package/abstract-interpretation/domains/set-upper-bound-domain.js +1 -1
  15. package/abstract-interpretation/domains/singleton-domain.d.ts +1 -1
  16. package/abstract-interpretation/domains/singleton-domain.js +1 -1
  17. package/abstract-interpretation/domains/state-abstract-domain.d.ts +1 -1
  18. package/abstract-interpretation/domains/state-abstract-domain.js +2 -2
  19. package/abstract-interpretation/unsupported-functions.d.ts +3 -2
  20. package/abstract-interpretation/unsupported-functions.js +38 -28
  21. package/cli/benchmark-app.js +2 -1
  22. package/cli/common/script.js +3 -2
  23. package/cli/flowr.js +47 -10
  24. package/cli/repl/commands/repl-cfg.js +9 -9
  25. package/cli/repl/commands/repl-commands.js +5 -0
  26. package/cli/repl/commands/repl-dataflow.js +31 -24
  27. package/cli/repl/commands/repl-main.d.ts +6 -0
  28. package/cli/repl/commands/repl-normalize.js +15 -12
  29. package/cli/repl/commands/repl-parse.js +1 -1
  30. package/cli/repl/commands/repl-query.js +4 -5
  31. package/cli/repl/commands/repl-quit.js +2 -1
  32. package/cli/repl/core.d.ts +11 -0
  33. package/cli/repl/core.js +101 -3
  34. package/cli/repl/execute.js +3 -2
  35. package/cli/repl/parser/slice-query-parser.d.ts +16 -0
  36. package/cli/repl/parser/slice-query-parser.js +52 -0
  37. package/cli/repl/server/connection.d.ts +1 -0
  38. package/cli/repl/server/connection.js +25 -0
  39. package/cli/repl/server/messages/message-analysis.d.ts +10 -0
  40. package/cli/repl/server/messages/message-analysis.js +6 -2
  41. package/cli/repl/server/messages/message-slice.d.ts +1 -1
  42. package/cli/script-core/statistics-core.js +2 -1
  43. package/cli/script-core/statistics-helper-core.js +2 -1
  44. package/cli/wiki.d.ts +2 -1
  45. package/cli/wiki.js +4 -1
  46. package/config.d.ts +9 -0
  47. package/config.js +23 -1
  48. package/control-flow/diff-cfg.d.ts +1 -1
  49. package/control-flow/diff-cfg.js +1 -1
  50. package/control-flow/extract-cfg.js +9 -3
  51. package/control-flow/semantic-cfg-guided-visitor.js +1 -0
  52. package/control-flow/simple-visitor.js +6 -5
  53. package/control-flow/useless-loop.js +2 -2
  54. package/core/print/dataflow-printer.d.ts +2 -2
  55. package/core/print/dataflow-printer.js +2 -2
  56. package/core/steps/all/static-slicing/00-slice.js +1 -1
  57. package/core/steps/pipeline/default-pipelines.d.ts +146 -146
  58. package/dataflow/environments/append.d.ts +2 -1
  59. package/dataflow/environments/append.js +2 -1
  60. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  61. package/dataflow/environments/built-in-proc-name.js +2 -0
  62. package/dataflow/environments/built-in.d.ts +2 -0
  63. package/dataflow/environments/built-in.js +2 -0
  64. package/dataflow/environments/default-builtin-config.d.ts +122 -66
  65. package/dataflow/environments/default-builtin-config.js +324 -145
  66. package/dataflow/environments/environment.d.ts +2 -1
  67. package/dataflow/environments/environment.js +13 -9
  68. package/dataflow/environments/identifier.d.ts +55 -2
  69. package/dataflow/environments/identifier.js +14 -2
  70. package/dataflow/environments/reference-to-maybe.d.ts +2 -0
  71. package/dataflow/environments/reference-to-maybe.js +56 -11
  72. package/dataflow/environments/resolve-by-name.js +13 -7
  73. package/dataflow/eval/values/general.js +4 -0
  74. package/dataflow/extractor.js +22 -3
  75. package/dataflow/graph/df-helper.d.ts +6 -0
  76. package/dataflow/graph/df-helper.js +33 -0
  77. package/dataflow/graph/graph.js +7 -3
  78. package/dataflow/info.d.ts +1 -1
  79. package/dataflow/info.js +3 -1
  80. package/dataflow/internal/linker.d.ts +5 -1
  81. package/dataflow/internal/linker.js +34 -9
  82. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +3 -1
  83. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +1 -1
  84. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +53 -0
  85. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +13 -0
  86. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +58 -0
  87. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -1
  88. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -1
  89. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +38 -14
  90. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +19 -0
  91. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +1 -1
  92. package/dataflow/internal/process/functions/call/known-call-handling.js +4 -3
  93. package/dataflow/internal/process/functions/call/named-call-handling.js +6 -0
  94. package/dataflow/origin/dfg-get-origin.d.ts +1 -1
  95. package/dataflow/origin/dfg-get-origin.js +1 -1
  96. package/dataflow/processor.d.ts +6 -0
  97. package/documentation/data/faq/faqs.d.ts +2 -1
  98. package/documentation/data/faq/faqs.js +75 -57
  99. package/documentation/data/server/doc-data-server-messages.d.ts +2 -1
  100. package/documentation/data/server/doc-data-server-messages.js +15 -7
  101. package/documentation/doc-readme.js +15 -15
  102. package/documentation/doc-util/doc-cfg.d.ts +3 -1
  103. package/documentation/doc-util/doc-cfg.js +3 -3
  104. package/documentation/doc-util/doc-dfg.d.ts +3 -1
  105. package/documentation/doc-util/doc-dfg.js +3 -3
  106. package/documentation/doc-util/doc-files.d.ts +3 -1
  107. package/documentation/doc-util/doc-files.js +9 -6
  108. package/documentation/doc-util/doc-normalized-ast.d.ts +3 -1
  109. package/documentation/doc-util/doc-normalized-ast.js +2 -2
  110. package/documentation/doc-util/doc-query.d.ts +2 -1
  111. package/documentation/doc-util/doc-query.js +2 -2
  112. package/documentation/doc-util/doc-repl.js +1 -0
  113. package/documentation/doc-util/doc-types.d.ts +6 -6
  114. package/documentation/doc-util/doc-types.js +11 -9
  115. package/documentation/issue-linting-rule.js +1 -2
  116. package/documentation/wiki-analyzer.js +9 -9
  117. package/documentation/wiki-cfg.js +40 -41
  118. package/documentation/wiki-core.js +119 -31
  119. package/documentation/wiki-create-linting-rules.d.ts +6 -0
  120. package/documentation/wiki-create-linting-rules.js +95 -0
  121. package/documentation/wiki-dataflow-graph.js +77 -76
  122. package/documentation/wiki-engine.js +1 -2
  123. package/documentation/wiki-faq.d.ts +2 -1
  124. package/documentation/wiki-faq.js +4 -4
  125. package/documentation/wiki-interface.js +19 -6
  126. package/documentation/wiki-linter.d.ts +1 -1
  127. package/documentation/wiki-linter.js +14 -6
  128. package/documentation/wiki-linting-and-testing.js +2 -2
  129. package/documentation/wiki-mk/doc-context.d.ts +3 -3
  130. package/documentation/wiki-mk/doc-maker.d.ts +2 -0
  131. package/documentation/wiki-mk/doc-maker.js +7 -1
  132. package/documentation/wiki-normalized-ast.js +5 -5
  133. package/documentation/wiki-onboarding.d.ts +2 -1
  134. package/documentation/wiki-onboarding.js +5 -5
  135. package/documentation/wiki-overview.js +3 -3
  136. package/documentation/wiki-query.js +85 -84
  137. package/documentation/wiki-search.js +4 -5
  138. package/documentation/wiki-setup.js +6 -7
  139. package/gas.d.ts +74 -0
  140. package/gas.js +18 -0
  141. package/linter/linter-executor.js +2 -8
  142. package/linter/linter-format.d.ts +4 -11
  143. package/linter/linter-rules.d.ts +88 -86
  144. package/linter/linter-rules.js +7 -1
  145. package/linter/rules/absolute-path.d.ts +2 -7
  146. package/linter/rules/absolute-path.js +6 -4
  147. package/linter/rules/dataframe-access-validation.d.ts +1 -6
  148. package/linter/rules/dataframe-access-validation.js +8 -6
  149. package/linter/rules/dead-code.d.ts +2 -11
  150. package/linter/rules/dead-code.js +16 -11
  151. package/linter/rules/deprecated-functions.d.ts +3 -3
  152. package/linter/rules/file-path-validity.d.ts +1 -6
  153. package/linter/rules/file-path-validity.js +5 -5
  154. package/linter/rules/function-finder-util.d.ts +7 -11
  155. package/linter/rules/function-finder-util.js +9 -6
  156. package/linter/rules/naming-convention.d.ts +2 -7
  157. package/linter/rules/naming-convention.js +3 -2
  158. package/linter/rules/network-functions.d.ts +2 -7
  159. package/linter/rules/network-functions.js +14 -12
  160. package/linter/rules/no-leaked-credentials.d.ts +36 -0
  161. package/linter/rules/no-leaked-credentials.js +75 -0
  162. package/linter/rules/problematic-inputs.d.ts +1 -8
  163. package/linter/rules/problematic-inputs.js +5 -4
  164. package/linter/rules/roxygen-arguments.d.ts +2 -7
  165. package/linter/rules/roxygen-arguments.js +13 -20
  166. package/linter/rules/seeded-randomness.d.ts +2 -7
  167. package/linter/rules/seeded-randomness.js +7 -4
  168. package/linter/rules/software-has-license.d.ts +31 -0
  169. package/linter/rules/software-has-license.js +46 -0
  170. package/linter/rules/software-has-tests.d.ts +38 -0
  171. package/linter/rules/software-has-tests.js +48 -0
  172. package/linter/rules/stop-with-call-arg.d.ts +2 -7
  173. package/linter/rules/stop-with-call-arg.js +3 -2
  174. package/linter/rules/unused-definition.d.ts +3 -8
  175. package/linter/rules/unused-definition.js +7 -5
  176. package/linter/rules/useless-loop.d.ts +2 -7
  177. package/linter/rules/useless-loop.js +5 -2
  178. package/package.json +3 -2
  179. package/project/context/flowr-analyzer-context.d.ts +13 -14
  180. package/project/context/flowr-analyzer-context.js +4 -0
  181. package/project/context/flowr-analyzer-files-context.d.ts +12 -0
  182. package/project/context/flowr-analyzer-files-context.js +12 -2
  183. package/project/context/flowr-analyzer-gas-context.d.ts +28 -0
  184. package/project/context/flowr-analyzer-gas-context.js +101 -0
  185. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +13 -7
  186. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +56 -11
  187. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
  188. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +2 -2
  189. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -1
  190. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +5 -5
  191. package/project/plugins/flowr-analyzer-plugin.d.ts +15 -8
  192. package/project/plugins/flowr-analyzer-plugin.js +14 -7
  193. package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.d.ts +19 -0
  194. package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.js +35 -0
  195. package/project/plugins/plugin-registry.d.ts +2 -1
  196. package/project/plugins/plugin-registry.js +3 -1
  197. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +22 -0
  198. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +47 -0
  199. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +1 -1
  200. package/queries/catalog/call-context-query/call-context-query-executor.js +54 -8
  201. package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -2
  202. package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
  203. package/queries/catalog/dependencies-query/function-info/test-functions.js +18 -177
  204. package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
  205. package/queries/catalog/dice-query/dice-query-executor.d.ts +8 -0
  206. package/queries/catalog/dice-query/dice-query-executor.js +52 -0
  207. package/queries/catalog/dice-query/dice-query-format.d.ts +53 -0
  208. package/queries/catalog/dice-query/dice-query-format.js +102 -0
  209. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
  210. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
  211. package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -0
  212. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
  213. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -0
  214. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
  215. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -0
  216. package/queries/catalog/linter-query/linter-query-executor.js +7 -0
  217. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
  218. package/queries/catalog/location-map-query/location-map-query-format.js +1 -0
  219. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
  220. package/queries/catalog/origin-query/origin-query-format.js +1 -0
  221. package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
  222. package/queries/catalog/provenance-query/provenance-query-format.js +1 -0
  223. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
  224. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -0
  225. package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
  226. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -0
  227. package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
  228. package/queries/query.d.ts +18 -1
  229. package/queries/query.js +3 -1
  230. package/r-bridge/data/data.d.ts +5 -0
  231. package/r-bridge/data/data.js +6 -0
  232. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +0 -1
  233. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +10 -1
  234. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.d.ts +1 -1
  235. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -1
  236. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.d.ts +1 -1
  237. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -1
  238. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +63 -44
  239. package/r-bridge/parser.js +2 -9
  240. package/r-bridge/shell.d.ts +8 -1
  241. package/r-bridge/shell.js +26 -7
  242. package/search/flowr-search-builder.d.ts +2 -2
  243. package/search/flowr-search-builder.js +1 -1
  244. package/search/flowr-search-filters.d.ts +30 -9
  245. package/search/flowr-search-filters.js +26 -21
  246. package/search/search-executor/search-enrichers.d.ts +600 -0
  247. package/search/search-executor/search-enrichers.js +23 -2
  248. package/slicing/static/static-slicer.d.ts +39 -11
  249. package/slicing/static/static-slicer.js +44 -14
  250. package/util/collections/queue.d.ts +16 -0
  251. package/util/collections/queue.js +38 -0
  252. package/util/log.d.ts +1 -1
  253. package/util/log.js +1 -1
  254. package/util/mermaid/dfg.d.ts +2 -2
  255. package/util/mermaid/dfg.js +2 -2
  256. package/util/objects.d.ts +9 -0
  257. package/util/objects.js +57 -1
  258. package/util/proc.d.ts +6 -0
  259. package/util/proc.js +20 -0
  260. package/util/version.js +1 -1
@@ -55,6 +55,42 @@ function processFunctionDefinition(name, args, rootId, data) {
55
55
  }
56
56
  const paramsEnvironments = data.environment;
57
57
  const body = (0, processor_1.processDataflowFor)(bodyArg, data);
58
+ for (const [, v] of body.graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
59
+ if (!v.origin.includes(built_in_proc_name_1.BuiltInProcName.Rm)) {
60
+ continue;
61
+ }
62
+ const ea = v.args.find(a => a !== r_function_call_1.EmptyArgument && graph_1.FunctionArgument.isNamed(a) && a.name === 'envir');
63
+ if (!ea || !graph_1.FunctionArgument.isNamed(ea)) {
64
+ continue;
65
+ }
66
+ const offset = parseSysFrameOffset(data.completeAst.idMap.get(ea.valueId ?? ea.nodeId));
67
+ if (offset === undefined || offset > 0) {
68
+ continue;
69
+ }
70
+ const names = [];
71
+ for (const a of v.args) {
72
+ if (a === r_function_call_1.EmptyArgument || (graph_1.FunctionArgument.isNamed(a) && a.name === 'envir')) {
73
+ continue;
74
+ }
75
+ const node = data.completeAst.idMap.get(graph_1.FunctionArgument.isNamed(a) ? (a.valueId ?? a.nodeId) : a.nodeId);
76
+ if (node?.type === type_1.RType.String) {
77
+ names.push(node.content.str);
78
+ }
79
+ else if (node?.type === type_1.RType.Symbol) {
80
+ names.push(node.content);
81
+ }
82
+ }
83
+ const targetLevel = offset === 0 ? 0 : originalEnvironment.level + 1 + offset;
84
+ let targetEnv = originalEnvironment;
85
+ while (targetEnv.level > targetLevel && targetEnv.level > 0) {
86
+ targetEnv = (0, scoping_1.popLocalEnvironment)(targetEnv);
87
+ }
88
+ if (targetEnv.level === targetLevel) {
89
+ for (const n of names) {
90
+ targetEnv.current.remove(n);
91
+ }
92
+ }
93
+ }
58
94
  // As we know, parameters cannot technically duplicate (i.e., their names are unique), we overwrite their environments.
59
95
  // This is the correct behavior, even if someone uses non-`=` arguments in functions.
60
96
  const bodyEnvironment = body.environment;
@@ -361,6 +397,23 @@ function updateNestedFunctionCalls(graph, outEnvironment) {
361
397
  }
362
398
  }
363
399
  }
400
+ function parseSysFrameOffset(node) {
401
+ if (!node || node.type !== type_1.RType.FunctionCall || !node.named || node.functionName.content !== 'sys.frame' || node.arguments.length !== 1) {
402
+ return undefined;
403
+ }
404
+ const arg = node.arguments[0];
405
+ if (arg === r_function_call_1.EmptyArgument || !arg.value) {
406
+ return undefined;
407
+ }
408
+ const v = arg.value;
409
+ if (v.type === type_1.RType.Number) {
410
+ return v.content.num;
411
+ }
412
+ if (v.type === type_1.RType.UnaryOp && v.operator === '-' && v.operand.type === type_1.RType.Number) {
413
+ return -v.operand.content.num;
414
+ }
415
+ return undefined;
416
+ }
364
417
  function prepareFunctionEnvironment(data, rootId) {
365
418
  let env = data.ctx.env.makeCleanEnv();
366
419
  for (let i = 0; i < data.environment.level + 1 /* add another env */; i++) {
@@ -0,0 +1,13 @@
1
+ import type { DataflowProcessorInformation } from '../../../../../processor';
2
+ import type { DataflowInformation } from '../../../../../info';
3
+ import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
4
+ import { type PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
5
+ import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
6
+ import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
7
+ /**
8
+ * Processes `::` and `:::` when called as a function, e.g., `::`(ggplot2, a).
9
+ * Constructs a namespaced symbol identical to what tree-sitter produces for `ggplot2::a`.
10
+ */
11
+ export declare function processNamespaceAccess<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: {
12
+ internal: boolean;
13
+ }): DataflowInformation;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.processNamespaceAccess = processNamespaceAccess;
4
+ const known_call_handling_1 = require("../known-call-handling");
5
+ const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
6
+ const logger_1 = require("../../../../../logger");
7
+ const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
8
+ const identifier_1 = require("../../../../../environments/identifier");
9
+ const graph_1 = require("../../../../../graph/graph");
10
+ const vertex_1 = require("../../../../../graph/vertex");
11
+ const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
12
+ const r_string_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
13
+ /**
14
+ * Processes `::` and `:::` when called as a function, e.g., `::`(ggplot2, a).
15
+ * Constructs a namespaced symbol identical to what tree-sitter produces for `ggplot2::a`.
16
+ */
17
+ function processNamespaceAccess(name, args, rootId, data, config) {
18
+ if (args.length !== 2 || args[0] === r_function_call_1.EmptyArgument || args[1] === r_function_call_1.EmptyArgument) {
19
+ logger_1.dataflowLogger.warn(`Namespace access ${identifier_1.Identifier.toString(name.content)} does not have exactly 2 non-empty arguments, falling back`);
20
+ return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.NamespaceAccess }).information;
21
+ }
22
+ const nsNode = args[0].value;
23
+ const symNode = args[1].value;
24
+ let namespace;
25
+ let symbolName;
26
+ if (nsNode?.type === type_1.RType.Symbol) {
27
+ namespace = identifier_1.Identifier.getName(nsNode.content);
28
+ }
29
+ else if (nsNode && r_string_1.RString.is(nsNode)) {
30
+ namespace = nsNode.content.str;
31
+ }
32
+ if (symNode?.type === type_1.RType.Symbol) {
33
+ symbolName = identifier_1.Identifier.getName(symNode.content);
34
+ }
35
+ else if (symNode && r_string_1.RString.is(symNode)) {
36
+ symbolName = symNode.content.str;
37
+ }
38
+ if (!namespace || !symbolName) {
39
+ logger_1.dataflowLogger.warn(`Namespace access ${identifier_1.Identifier.toString(name.content)} has non-symbol/string arguments, falling back`);
40
+ return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.NamespaceAccess }).information;
41
+ }
42
+ const id = identifier_1.Identifier.make(symbolName, namespace, config.internal);
43
+ return {
44
+ unknownReferences: [{ nodeId: rootId, name: id, cds: data.cds, type: identifier_1.ReferenceType.Unknown }],
45
+ in: [],
46
+ out: [],
47
+ environment: data.environment,
48
+ graph: new graph_1.DataflowGraph(data.completeAst.idMap).addVertex({
49
+ tag: vertex_1.VertexType.Use,
50
+ id: rootId,
51
+ cds: data.cds
52
+ }, data.ctx.env.makeCleanEnv()),
53
+ entryPoint: rootId,
54
+ exitPoints: [{ nodeId: rootId, type: 0 /* ExitPointType.Default */, cds: data.cds }],
55
+ hooks: []
56
+ };
57
+ }
58
+ //# sourceMappingURL=built-in-namespace-access.js.map
@@ -41,7 +41,7 @@ function processRepeatLoop(name, args, rootId, data) {
41
41
  });
42
42
  const body = processedArguments[0];
43
43
  (0, assert_1.guard)(body !== undefined, () => `Repeat-Loop ${identifier_1.Identifier.toString(name.content)} has no body, impossible!`);
44
- (0, linker_1.linkCircularRedefinitionsWithinALoop)(information.graph, (0, linker_1.produceNameSharedIdMap)((0, linker_1.findNonLocalReads)(information.graph)), body.out);
44
+ (0, linker_1.linkCircularRedefinitionsWithinALoop)(information.graph, (0, linker_1.produceNameSharedIdMap)((0, linker_1.findNonLocalReads)(information.graph)), body.out, body.environment);
45
45
  (0, linker_1.reapplyLoopExitPoints)(body.exitPoints, body.in.concat(body.out, body.unknownReferences), information.graph);
46
46
  information.exitPoints = (0, info_1.filterOutLoopExitPoints)(information.exitPoints);
47
47
  return information;
@@ -1,7 +1,7 @@
1
1
  import type { DataflowProcessorInformation } from '../../../../../processor';
2
2
  import type { DataflowInformation } from '../../../../../info';
3
3
  import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
4
- import { type PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
4
+ import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
5
5
  import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
6
6
  import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
7
7
  /**
@@ -2,10 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.processRm = processRm;
4
4
  const known_call_handling_1 = require("../known-call-handling");
5
- const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
6
5
  const logger_1 = require("../../../../../logger");
7
6
  const type_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/type");
8
7
  const built_in_proc_name_1 = require("../../../../../environments/built-in-proc-name");
8
+ const linker_1 = require("../../../../linker");
9
+ const r_argument_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
10
+ const common_1 = require("../common");
11
+ const alias_tracking_1 = require("../../../../../eval/resolve/alias-tracking");
12
+ const general_1 = require("../../../../../eval/values/general");
13
+ const r_value_1 = require("../../../../../eval/values/r-value");
9
14
  /**
10
15
  * Process an `rm` call.
11
16
  */
@@ -16,25 +21,44 @@ function processRm(name, args, rootId, data) {
16
21
  }
17
22
  const res = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: built_in_proc_name_1.BuiltInProcName.Rm }).information;
18
23
  const names = [];
19
- for (const arg of args) {
20
- if (arg === r_function_call_1.EmptyArgument) {
21
- logger_1.dataflowLogger.warn('empty argument in rm, skipping');
22
- continue;
24
+ const argMaps = (0, linker_1.pMatch)((0, common_1.convertFnArguments)(args), { '...': '...', 'list': 'list', 'envir': 'envir' });
25
+ for (const dotId of argMaps.get('...') ?? []) {
26
+ const value = r_argument_1.RArgument.getWithId(args, dotId)?.value;
27
+ if (value?.type === type_1.RType.Symbol) {
28
+ names.push(value.content);
29
+ }
30
+ else if (value?.type === type_1.RType.String) {
31
+ names.push(value.content.str);
32
+ }
33
+ else if (value !== undefined) {
34
+ logger_1.dataflowLogger.warn(`argument is not a symbol or string in rm, skipping ${JSON.stringify(value)}`);
23
35
  }
24
- const unpacked = arg.value;
25
- if (unpacked === undefined || (unpacked.type !== type_1.RType.Symbol && unpacked.type !== type_1.RType.String)) {
26
- logger_1.dataflowLogger.warn(`argument is not a symbol or string, skipping ${JSON.stringify(unpacked)}`);
36
+ }
37
+ for (const listId of argMaps.get('list') ?? []) {
38
+ const value = r_argument_1.RArgument.getWithId(args, listId)?.value;
39
+ if (!value) {
40
+ continue;
27
41
  }
28
- else if (unpacked.type === type_1.RType.Symbol) {
29
- names.push(unpacked.content);
42
+ if (value.type === type_1.RType.String) {
43
+ names.push(value.content.str);
30
44
  }
31
- else if (unpacked.type === type_1.RType.String) {
32
- names.push(unpacked.content.str);
45
+ else {
46
+ const resolved = (0, general_1.valueSetGuard)((0, alias_tracking_1.resolveIdToValue)(value.info.id, {
47
+ environment: data.environment,
48
+ idMap: data.completeAst.idMap,
49
+ resolve: data.ctx.config.solver.variables,
50
+ ctx: data.ctx
51
+ }));
52
+ for (const r of resolved?.elements ?? []) {
53
+ if (r.type === 'string' && (0, r_value_1.isValue)(r.value)) {
54
+ names.push(r.value.str);
55
+ }
56
+ }
33
57
  }
34
58
  }
35
59
  let env = res.environment.current;
36
- for (const name of names) {
37
- env = env.remove(name);
60
+ for (const n of names) {
61
+ env = env.remove(n);
38
62
  }
39
63
  return {
40
64
  ...res,
@@ -25,6 +25,7 @@ const parser_1 = require("../../../../../../r-bridge/lang-4.x/ast/parser/json/pa
25
25
  const shell_executor_1 = require("../../../../../../r-bridge/shell-executor");
26
26
  const assert_1 = require("../../../../../../util/assert");
27
27
  const path_1 = __importDefault(require("path"));
28
+ const gas_1 = require("../../../../../../gas");
28
29
  const general_1 = require("../../../../../eval/values/general");
29
30
  const r_value_1 = require("../../../../../eval/values/r-value");
30
31
  const unknown_side_effect_1 = require("../../../../../graph/unknown-side-effect");
@@ -210,6 +211,24 @@ function sourceRequest(rootId, request, data, information, makeMaybe, getId) {
210
211
  else {
211
212
  (0, assert_1.guard)(textRequest !== undefined, `Expected text request to be defined for sourced file ${JSON.stringify(request)}`);
212
213
  }
214
+ if (textRequest.path) {
215
+ const dotIdx = textRequest.path.lastIndexOf('.');
216
+ const ext = dotIdx >= 0 ? textRequest.path.slice(dotIdx).toLowerCase() : '';
217
+ if (ext !== '' && ext !== '.r') {
218
+ (0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `Skipping source of non-R file ${JSON.stringify(textRequest.path)}`);
219
+ (0, unknown_side_effect_1.handleUnknownSideEffect)(information.graph, information.environment, rootId);
220
+ return information;
221
+ }
222
+ }
223
+ const gasLevel = data.ctx.gas.checkGas(gas_1.GasFeatureKey.Source);
224
+ if (gasLevel >= 2 /* GasLevel.Critical */) {
225
+ logger_1.dataflowLogger.warn(`Skipping source of ${JSON.stringify(request)} due to resource pressure (gas: critical). See ${gas_1.GasWikiRef}`);
226
+ (0, unknown_side_effect_1.handleUnknownSideEffect)(information.graph, information.environment, rootId);
227
+ return information;
228
+ }
229
+ else if (gasLevel >= 1 /* GasLevel.Problematic */) {
230
+ logger_1.dataflowLogger.warn(`Approaching resource limits for source of ${JSON.stringify(request)} (gas: problematic). See ${gas_1.GasWikiRef}`);
231
+ }
213
232
  const parsed = (!data.parser.async ? data.parser : new shell_executor_1.RShellExecutor()).parse(textRequest.r);
214
233
  const normalized = (typeof parsed !== 'string' ?
215
234
  (0, parser_1.normalizeTreeSitter)({ files: [{ parsed, filePath: textRequest.path }] }, getId, data.ctx.config)
@@ -74,7 +74,7 @@ function processWhileLoop(name, args, rootId, data) {
74
74
  (0, reference_to_maybe_1.applyCdsToAllInGraphButConstants)(body.graph, bodyRead, cdTrue);
75
75
  const remainingInputs = (0, linker_1.linkInputs)(bodyRead, information.environment, condition.in.concat(condition.unknownReferences), information.graph, true);
76
76
  (0, reference_to_maybe_1.applyCdToReferences)(body.out, cdTrue);
77
- (0, linker_1.linkCircularRedefinitionsWithinALoop)(information.graph, (0, linker_1.produceNameSharedIdMap)((0, linker_1.findNonLocalReads)(information.graph, new Set(condition.in.map(i => i.nodeId)))), body.out);
77
+ (0, linker_1.linkCircularRedefinitionsWithinALoop)(information.graph, (0, linker_1.produceNameSharedIdMap)((0, linker_1.findNonLocalReads)(information.graph, new Set(condition.in.map(i => i.nodeId)))), body.out, body.environment);
78
78
  (0, linker_1.reapplyLoopExitPoints)(body.exitPoints, body.in.concat(body.out, body.unknownReferences), information.graph);
79
79
  // as the while-loop always evaluates its condition
80
80
  information.graph.addEdge(nameId, condition.entryPoint, edge_1.EdgeType.Reads);
@@ -40,13 +40,14 @@ function processKnownFunctionCall({ name, args, rootId, data, reverseOrder = fal
40
40
  if (markAsNSE) {
41
41
  markNonStandardEvaluationEdges(markAsNSE, processedArguments, finalGraph, rootId);
42
42
  }
43
+ const onlyBuiltin = data.builtInNoEnv === rootId;
43
44
  finalGraph.addVertex({
44
45
  tag: vertex_1.VertexType.FunctionCall,
45
46
  id: rootId,
46
- environment: data.environment,
47
+ environment: onlyBuiltin ? undefined : data.environment,
47
48
  name: functionCallName,
48
- /* will be overwritten accordingly */
49
- onlyBuiltin: false,
49
+ /* may still be overwritten by markAsOnlyBuiltIn */
50
+ onlyBuiltin,
50
51
  cds: data.cds,
51
52
  args: reverseOrder ? callArgs.toReversed() : callArgs,
52
53
  origin: origin === 'default' ? [built_in_proc_name_1.BuiltInProcName.Function] : [origin]
@@ -46,6 +46,12 @@ function markAsOnlyBuiltIn(graph, rootId) {
46
46
  function processNamedCall(name, args, rootId, data) {
47
47
  const resolved = (0, resolve_by_name_1.resolveByName)(name.content, data.environment, identifier_1.ReferenceType.Function) ?? [];
48
48
  let defaultProcessor = resolved.length === 0;
49
+ /* if this call will be marked as built-in only (see below), its vertex needs no environment snapshot */
50
+ if (resolved.length > 0
51
+ && resolved.every(r => r.type === identifier_1.ReferenceType.BuiltInFunction && typeof r.processor === 'function')
52
+ && resolved.some(r => r.type === identifier_1.ReferenceType.BuiltInFunction && r.config?.libFn !== true)) {
53
+ data = { ...data, builtInNoEnv: rootId };
54
+ }
49
55
  let information = undefined;
50
56
  let builtIn = false;
51
57
  for (const resolvedFunction of resolved) {
@@ -70,7 +70,7 @@ export type Origin = SimpleOrigin | FunctionCallOrigin | BuiltInFunctionOrigin;
70
70
  * }
71
71
  * print(x)
72
72
  * ```
73
- * Requesting the origin of `x` in the `print(x)` node yields two {@link SimpleOriginOrigin|variable origins} for both
73
+ * Requesting the origin of `x` in the `print(x)` node yields two {@link SimpleOrigin|variable origins} for both
74
74
  * definitions of `x`.
75
75
  * Similarly, requesting the origin of `print` returns a {@link BuiltInFunctionOrigin|`BuiltInFunctionOrigin`}.
76
76
  *
@@ -16,7 +16,7 @@ const assert_1 = require("../../util/assert");
16
16
  * }
17
17
  * print(x)
18
18
  * ```
19
- * Requesting the origin of `x` in the `print(x)` node yields two {@link SimpleOriginOrigin|variable origins} for both
19
+ * Requesting the origin of `x` in the `print(x)` node yields two {@link SimpleOrigin|variable origins} for both
20
20
  * definitions of `x`.
21
21
  * Similarly, requesting the origin of `print` returns a {@link BuiltInFunctionOrigin|`BuiltInFunctionOrigin`}.
22
22
  *
@@ -7,6 +7,7 @@ import type { REnvironmentInformation } from './environments/environment';
7
7
  import type { RNode } from '../r-bridge/lang-4.x/ast/model/model';
8
8
  import type { KnownParserType, Parser } from '../r-bridge/parser';
9
9
  import type { FlowrAnalyzerContext } from '../project/context/flowr-analyzer-context';
10
+ import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
10
11
  export interface DataflowProcessorInformation<OtherInfo> {
11
12
  readonly parser: Parser<KnownParserType>;
12
13
  /**
@@ -35,6 +36,11 @@ export interface DataflowProcessorInformation<OtherInfo> {
35
36
  * The flowr context used for environment seeding, files, and precision control, ...
36
37
  */
37
38
  readonly ctx: FlowrAnalyzerContext;
39
+ /**
40
+ * If set, the function call with this id is known to resolve to built-ins only,
41
+ * so its vertex needs no environment snapshot (it would be discarded by markAsOnlyBuiltIn anyway).
42
+ */
43
+ readonly builtInNoEnv?: NodeId;
38
44
  }
39
45
  export type DataflowProcessor<OtherInfo, NodeType extends RNodeWithParent<OtherInfo>> = (node: NodeType, data: DataflowProcessorInformation<OtherInfo>) => DataflowInformation;
40
46
  type NodeWithKey<OtherInfo, Key> = RNode<OtherInfo & ParentInformation> & {
@@ -1,5 +1,6 @@
1
1
  import { FaqStore } from './wiki-faq-store';
2
+ import type { GeneralDocContext } from '../../wiki-mk/doc-context';
2
3
  /**
3
4
  *
4
5
  */
5
- export declare function registerFaqs(): FaqStore;
6
+ export declare function registerFaqs(ctx: GeneralDocContext): FaqStore;
@@ -8,79 +8,97 @@ const recommended_configs_1 = require("./recommended-configs");
8
8
  /**
9
9
  *
10
10
  */
11
- function registerFaqs() {
11
+ function registerFaqs(ctx) {
12
12
  const wikiFaq = new wiki_faq_store_1.FaqStore();
13
13
  wikiFaq.withTopic('flowr.development')
14
- .addFaq('What are *test labels*?', `
15
- Tests are labeled based on the *flowR* capabilities that they test for.
16
- The list of supported capabilities can be found on the [Capabilities](${doc_files_1.FlowrWikiBaseRef}/Capabilities) wiki page.
17
- For more extensive information on test labels, see the [test labels wiki section](${doc_files_1.FlowrWikiBaseRef}/Linting-and-Testing#test-labels).
14
+ .addFaq('What are *test labels*?', `
15
+ Tests are labeled based on the *flowR* capabilities that they test for.
16
+ The list of supported capabilities can be found on the ${ctx.linkPage('wiki/Capabilities', 'Capabilities')} wiki page.
17
+ For more extensive information on test labels, see the ${ctx.linkPage('wiki/Linting and Testing', 'test labels wiki section', 'test-labels')}.
18
18
  `)
19
- .addFaq('How to get a REPL with debug-info/*hot-reload*?', `
20
- To enter the development repl, execute \`npm run main-dev\` in contrast to \`npm run flowr\`
21
- this will use an unminified build (keeping debug info) and also watches the source files for changes.
22
- In case of a change, this mode automatically recompiles.
23
- Please note, that this may have negative performance implications (so do not use this for e.g., benchmarking).
19
+ .addFaq('How to get a REPL with debug-info/*hot-reload*?', `
20
+ To enter the development repl, execute \`npm run main-dev\` in contrast to \`npm run flowr\`
21
+ this will use an unminified build (keeping debug info) and also watches the source files for changes.
22
+ In case of a change, this mode automatically recompiles.
23
+ Please note, that this may have negative performance implications (so do not use this for e.g., benchmarking).
24
24
  `)
25
- .addFaq('How to generate *mermaid diagrams*?', `
26
- There are several ways to generate mermaid diagrams based on the input data that you want to use.
27
- - From the AST (abstract syntax tree): ${(0, doc_files_1.getFilePathMd)('../util/mermaid/ast.ts')}
28
- - From the CFG (control flow graph): ${(0, doc_files_1.getFilePathMd)('../util/mermaid/cfg.ts')}
29
- - From the DFG (dataflow graph): ${(0, doc_files_1.getFilePathMd)('../util/mermaid/dfg.ts')}
25
+ .addFaq('How to generate *mermaid diagrams*?', `
26
+ There are several ways to generate mermaid diagrams based on the input data that you want to use.
27
+ - From the AST (abstract syntax tree): ${(0, doc_files_1.getFilePathMd)('../util/mermaid/ast.ts')}
28
+ - From the CFG (control flow graph): ${(0, doc_files_1.getFilePathMd)('../util/mermaid/cfg.ts')}
29
+ - From the DFG (dataflow graph): ${(0, doc_files_1.getFilePathMd)('../util/mermaid/dfg.ts')}
30
30
  `)
31
- .addFaq('How to create *new wiki* pages?', `
32
- To create an automatically generated wiki page, you can follow these steps:
33
- - Create a new file in \`src/documentation\` with a name like \`wiki-thename.ts\`.
34
- - Register your new wiki page in the \`src/cli/wiki.ts\` file to have it executed by the wiki generation tool.
35
-
36
- You can test your page by piping the wiki generation script to a file. For example, you can run the following command:
37
- ${(0, doc_code_1.codeBlock)('shell', 'npm run wiki')}
38
- Alternatively use the following to generate a specific wiki page:
39
- ${(0, doc_code_1.codeBlock)('shell', 'npm run wiki -- --filter=Dataflow')}
40
- Or, activate the watch mode to automatically regenerate the wiki on changes:
41
- ${(0, doc_code_1.codeBlock)('shell', 'npm run wiki:watch')}
42
-
31
+ .addFaq('How to create *new wiki* pages?', `
32
+ To create an automatically generated wiki page, you can follow these steps:
33
+ - Create a new file in \`src/documentation\` with a name like \`wiki-thename.ts\`.
34
+ - Register your new wiki page in the \`src/cli/wiki.ts\` file to have it executed by the wiki generation tool.
35
+
36
+ You can test your page by piping the wiki generation script to a file. For example, you can run the following command:
37
+ ${(0, doc_code_1.codeBlock)('shell', 'npm run wiki')}
38
+ Alternatively use the following to generate a specific wiki page:
39
+ ${(0, doc_code_1.codeBlock)('shell', 'npm run wiki -- --filter=Dataflow')}
40
+ Or, activate the watch mode to automatically regenerate the wiki on changes:
41
+ ${(0, doc_code_1.codeBlock)('shell', 'npm run wiki:watch')}
42
+
43
43
  `)
44
- .addFaq('Why can\'t I pass *arguments* when running flowR *with npm*?', `
45
- With \`npm\` you have to pass arguments in a specific way. The \`--\` operator is used to separate the \`npm\` arguments from the script arguments. For example, if you want to run \`flowR\` with the \`--help\` argument, you can use the following command:
46
- ${(0, doc_code_1.codeBlock)('shell', 'npm run flowR -- --help')}
44
+ .addFaq('Why can\'t I pass *arguments* when running flowR *with npm*?', `
45
+ With \`npm\` you have to pass arguments in a specific way. The \`--\` operator is used to separate the \`npm\` arguments from the script arguments. For example, if you want to run \`flowR\` with the \`--help\` argument, you can use the following command:
46
+ ${(0, doc_code_1.codeBlock)('shell', 'npm run flowR -- --help')}
47
47
  `)
48
- .addFaq('How to do *logging* in flowR?', `
49
- Check out the [Logging Section in the Linting and Testing wiki page](${doc_files_1.FlowrWikiBaseRef}/Linting-and-Testing#logging) for more information on how to do logging in *flowR*.
48
+ .addFaq('How to do *logging* in flowR?', `
49
+ Check out the ${ctx.linkPage('wiki/Linting and Testing', 'Logging Section in the Linting and Testing wiki page', 'logging')} for more information on how to do logging in *flowR*.
50
+ `)
51
+ .addFaq('How to run *tests* with *verbose* logging?', `
52
+ Use the dedicated npm script to run all tests with trace-level log output:
53
+ ${(0, doc_code_1.codeBlock)('shell', 'npm run test:verbose')}
54
+ Alternatively, set the \`FLOWR_VERBOSE\` environment variable directly:
55
+ ${(0, doc_code_1.codeBlock)('shell', 'FLOWR_VERBOSE=true npm run test')}
56
+ Both forms accept the usual vitest filters (e.g. \`npm run test:verbose -- cli/server\`).
57
+ `)
58
+ .addFaq('How to add a *linting rule*?', `
59
+ To add a new linting rule, see ${ctx.linkPage('wiki/Create Linting Rules')}.
50
60
  `);
51
61
  wikiFaq.withTopic('flowr.use')
52
- .addFaq('How to *query* an R project?', `
53
- For this you can use flowR's [Query API](${doc_files_1.FlowrWikiBaseRef}/Query-API).
54
- If you want to create your own project using flowR as a library, check out the
55
- [${doc_files_1.FlowrGithubGroupName}/sample-analyzer-project-query](${doc_files_1.FlowrGithubBaseRef}/sample-analyzer-project-query) repository for an example project setup.
62
+ .addFaq('How to *watch* a file for changes in the REPL?', `
63
+ Replace the \`file://\` prefix with \`watch://\` when passing a path to any REPL command.
64
+ flowR will run the command immediately and then re-run it every time the file (or any file inside the specified folder) changes.
65
+ Press Ctrl+C or enter any other command to leave watch mode.
66
+ ${(0, doc_code_1.codeBlock)('shell', ':df watch://path/to/analysis.R')}
67
+ For a folder, flowR uses the same project discovery as with \`file://\`:
68
+ ${(0, doc_code_1.codeBlock)('shell', ':query @linter watch://path/to/project')}
69
+ `)
70
+ .addFaq('How to *query* an R project?', `
71
+ For this you can use flowR's ${ctx.linkPage('wiki/Query API', 'Query API')}.
72
+ If you want to create your own project using flowR as a library, check out the
73
+ [${doc_files_1.FlowrGithubGroupName}/sample-analyzer-project-query](${doc_files_1.FlowrGithubBaseRef}/sample-analyzer-project-query) repository for an example project setup.
56
74
  `);
57
75
  wikiFaq.withTopic('r.packages')
58
- .addFaq('What is the R *prelude* and R *base* package?', `
59
- The base package contains lots of base functions like \`source\` for example.
60
- The R prelude includes the base package along with several other packages.
61
- Packages that were loaded by the prelude can be called without prefixing the
62
- function call with the package name and the \`::\` operator.
63
-
64
- The packages loaded by the R prelude can be seen in the \`attached base packages\`
65
- sections in the output of \`sessionInfo()\`.
76
+ .addFaq('What is the R *prelude* and R *base* package?', `
77
+ The base package contains lots of base functions like \`source\` for example.
78
+ The R prelude includes the base package along with several other packages.
79
+ Packages that were loaded by the prelude can be called without prefixing the
80
+ function call with the package name and the \`::\` operator.
81
+
82
+ The packages loaded by the R prelude can be seen in the \`attached base packages\`
83
+ sections in the output of \`sessionInfo()\`.
66
84
  `)
67
- .addFaq('How to get *documentation* for a function or package?', `
68
- There are a couple of ways to get documentation for a function or package.
69
-
70
- 🖥️ Firstly, if you have already installed the package the function originated from you can simply run \`?<package name>::<function name>\` in an R session to print the
71
- relevant documentation. If you don't know the origin of the package, you can use
72
- \`??<function name>\` in an R shell to fuzzy find all documentations containing
73
- \`<function name>\` or something similar.
74
-
75
- 🌐 Secondly, if you don't have or don't want to install the package you can simply google the fully qualified name of the function. Good sources include [rdrr.io](https://rdrr.io/)
76
- or [rdocumentation.org](https://rdocumentation.org/). Additionally, the package documentation PDF can also
77
- be downloaded directly from [cran](https://cran.r-project.org/).
85
+ .addFaq('How to get *documentation* for a function or package?', `
86
+ There are a couple of ways to get documentation for a function or package.
87
+
88
+ 🖥️ Firstly, if you have already installed the package the function originated from you can simply run \`?<package name>::<function name>\` in an R session to print the
89
+ relevant documentation. If you don't know the origin of the package, you can use
90
+ \`??<function name>\` in an R shell to fuzzy find all documentations containing
91
+ \`<function name>\` or something similar.
92
+
93
+ 🌐 Secondly, if you don't have or don't want to install the package you can simply google the fully qualified name of the function. Good sources include [rdrr.io](https://rdrr.io/)
94
+ or [rdocumentation.org](https://rdocumentation.org/). Additionally, the package documentation PDF can also
95
+ be downloaded directly from [cran](https://cran.r-project.org/).
78
96
  `);
79
97
  wikiFaq.withTopic('editor.configs')
80
- .addFaq('How can I make eslint and ZED work together?', `Use this project config (\`.zed/settings.json\`) to disable all formatters except eslint:
98
+ .addFaq('How can I make eslint and ZED work together?', `Use this project config (\`.zed/settings.json\`) to disable all formatters except eslint:
81
99
  ${(0, doc_code_1.codeBlock)('json', JSON.stringify(recommended_configs_1.recommendedZedConfig, null, 2))}`);
82
100
  wikiFaq.withTopic('editor.configs')
83
- .addFaq('How can I launch the flowr repl form vs code?', `You can use the following launch task (\`.vscode/launch.json\`):
101
+ .addFaq('How can I launch the flowr repl form vs code?', `You can use the following launch task (\`.vscode/launch.json\`):
84
102
  ${(0, doc_code_1.codeBlock)('json', JSON.stringify(recommended_configs_1.recommendedVsCodeTask, null, 2))}`);
85
103
  return wikiFaq;
86
104
  }
@@ -1,4 +1,5 @@
1
+ import type { GeneralDocContext } from '../../wiki-mk/doc-context';
1
2
  /**
2
3
  *
3
4
  */
4
- export declare function documentAllServerMessages(): void;
5
+ export declare function documentAllServerMessages(ctx: GeneralDocContext): void;
@@ -20,7 +20,7 @@ const identify_link_to_last_call_relation_1 = require("../../../queries/catalog/
20
20
  /**
21
21
  *
22
22
  */
23
- function documentAllServerMessages() {
23
+ function documentAllServerMessages(ctx) {
24
24
  (0, doc_server_message_1.documentServerMessage)({
25
25
  title: 'Hello',
26
26
  type: 'response',
@@ -78,6 +78,14 @@ Furthermore, the request must contain either a \`content\` field to directly pas
78
78
  If you add the \`id\` field, the answer will use the same \`id\` so you can match requests and the corresponding answers.
79
79
  See the implementation of the request-file-analysis message for more information.
80
80
 
81
+ You can drop one or more stored file tokens by adding the \`invalidateToken\` field (a single token or an array of tokens).
82
+ The server frees the corresponding analyses _after_ it has answered the request.
83
+
84
+ > **Tip!**\\
85
+ > If you only want to drop tokens, you do not need a separate message: send a \`request-file-analysis\` that contains _just_ the \`invalidateToken\` field (and no \`content\` or \`filepath\`).
86
+ > Such a request behaves like an empty file analysis and the server replies with an empty \`results\` object.
87
+ > Because invalidation happens after the response, you may even pass the _current_ \`filetoken\` in \`invalidateToken\` to analyze a file once and have the server forget it right after you received the results.
88
+
81
89
  ${await (0, doc_server_message_1.documentServerMessageResponse)({
82
90
  shell,
83
91
  messageType: 'request-file-analysis',
@@ -101,8 +109,8 @@ ${await (0, doc_server_message_1.documentServerMessageResponse)({
101
109
  The \`results\` field of the response effectively contains three keys of importance:
102
110
 
103
111
  - \`parse\`: which contains 1:1 the parse result in CSV format that we received from the \`${shell_1.RShell.name}\` (i.e., the AST produced by the parser of the R interpreter).
104
- - \`normalize\`: which contains the normalized AST, including ids (see the \`info\` field and the [Normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized%20AST) wiki page).
105
- - \`dataflow\`: especially important is the \`graph\` field which contains the dataflow graph as a set of root vertices (see the [Dataflow Graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph) wiki page).
112
+ - \`normalize\`: which contains the normalized AST, including ids (see the \`info\` field and the ${ctx.linkPage('wiki/Normalized AST', 'Normalized AST')} wiki page).
113
+ - \`dataflow\`: especially important is the \`graph\` field which contains the dataflow graph as a set of root vertices (see the ${ctx.linkPage('wiki/Dataflow Graph', 'Dataflow Graph')} wiki page).
106
114
  `
107
115
  }
108
116
  ]
@@ -172,7 +180,7 @@ If you are interested in a visual representation of the control flow graph, see
172
180
  **Retrieve the Output as RDF N-Quads**
173
181
 
174
182
  The default response is formatted as JSON.
175
- However, by specifying \`format: "n-quads"\`, you can retrieve the individual results (e.g., the [Normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized%20AST)),
183
+ However, by specifying \`format: "n-quads"\`, you can retrieve the individual results (e.g., the ${ctx.linkPage('wiki/Normalized AST', 'Normalized AST')}),
176
184
  as [RDF N-Quads](https://www.w3.org/TR/n-quads/).
177
185
  This works with and without the control flow graph as described [above](#analysis-include-cfg).
178
186
 
@@ -254,7 +262,7 @@ Please note, that the base message format is still JSON. Only the individual res
254
262
  shortDescription: `${deprecatedByQuery} The server slices a file based on the given criteria.`,
255
263
  text: async (shell) => {
256
264
  return `
257
- **We deprecated the slice request in favor of the \`static-slice\` [Query](${doc_files_1.FlowrWikiBaseRef}/Query%20API).**
265
+ **We deprecated the slice request in favor of the \`static-slice\` ${ctx.linkPage('wiki/Query API', 'Query')}.**
258
266
 
259
267
  To slice, you have to send a file analysis request first. The \`filetoken\` you assign is of use here as you can re-use it to repeatedly slice the same file.
260
268
  Besides that, you only need to add an array of slicing criteria, using one of the formats described on the [terminology wiki page](${doc_files_1.FlowrWikiBaseRef}/Terminology#slicing-criterion)
@@ -353,7 +361,7 @@ Within a document that is to be sliced, you can use magic comments to influence
353
361
 
354
362
 
355
363
  The REPL execution message allows to send a REPL command to receive its output.
356
- For more on the REPL, see the [introduction](${doc_files_1.FlowrWikiBaseRef}/Overview#the-read-eval-print-loop-repl), or the [description below](#using-the-repl).
364
+ For more on the REPL, see the ${ctx.linkPage('wiki/Overview', 'introduction', 'the-read-eval-print-loop-repl')}, or the [description below](#using-the-repl).
357
365
  You only have to pass the command you want to execute in the \`expression\` field.
358
366
  Furthermore, you can set the \`ansi\` field to \`true\` if you are interested in output formatted using [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code).
359
367
  We strongly recommend you to make use of the \`id\` field to link answers with requests as you can theoretically request the execution of multiple scripts at the same time, which then happens in parallel.
@@ -423,7 +431,7 @@ ${(0, doc_code_1.codeBlock)('text', msg.result)}
423
431
  text: async (shell) => {
424
432
  return `
425
433
  To send queries, you have to send an [analysis request](#message-request-file-analysis) first. The \`filetoken\` you assign is of use here as you can re-use it to repeatedly query the same file.
426
- This message provides direct access to _flowR_'s Query API. Please consult the [Query API documentation](${doc_files_1.FlowrWikiBaseRef}/Query%20API) for more information.
434
+ This message provides direct access to _flowR_'s Query API. Please consult the ${ctx.linkPage('wiki/Query API', 'Query API documentation')} for more information.
427
435
 
428
436
  ${await (0, doc_server_message_1.documentServerMessageResponse)({
429
437
  shell,