@eagleoutice/flowr 2.10.9 → 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 (256) hide show
  1. package/README.md +103 -33
  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 -10
  47. package/config.js +25 -7
  48. package/control-flow/diff-cfg.d.ts +1 -1
  49. package/control-flow/diff-cfg.js +1 -1
  50. package/control-flow/semantic-cfg-guided-visitor.js +1 -0
  51. package/control-flow/simple-visitor.js +6 -5
  52. package/control-flow/useless-loop.js +2 -2
  53. package/core/print/dataflow-printer.d.ts +2 -2
  54. package/core/print/dataflow-printer.js +2 -2
  55. package/core/steps/all/static-slicing/00-slice.js +1 -1
  56. package/core/steps/pipeline/default-pipelines.d.ts +146 -146
  57. package/dataflow/environments/append.d.ts +2 -1
  58. package/dataflow/environments/append.js +2 -1
  59. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  60. package/dataflow/environments/built-in-proc-name.js +2 -0
  61. package/dataflow/environments/built-in.d.ts +2 -0
  62. package/dataflow/environments/built-in.js +2 -0
  63. package/dataflow/environments/default-builtin-config.d.ts +122 -66
  64. package/dataflow/environments/default-builtin-config.js +324 -145
  65. package/dataflow/environments/environment.d.ts +2 -1
  66. package/dataflow/environments/environment.js +13 -9
  67. package/dataflow/environments/identifier.d.ts +55 -2
  68. package/dataflow/environments/identifier.js +14 -2
  69. package/dataflow/environments/reference-to-maybe.d.ts +2 -0
  70. package/dataflow/environments/reference-to-maybe.js +56 -11
  71. package/dataflow/environments/resolve-by-name.js +13 -7
  72. package/dataflow/eval/values/general.js +4 -0
  73. package/dataflow/extractor.js +12 -2
  74. package/dataflow/graph/df-helper.d.ts +6 -0
  75. package/dataflow/graph/df-helper.js +33 -0
  76. package/dataflow/graph/graph.js +1 -1
  77. package/dataflow/info.d.ts +1 -1
  78. package/dataflow/internal/linker.d.ts +5 -1
  79. package/dataflow/internal/linker.js +34 -9
  80. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +1 -1
  81. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +53 -0
  82. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +13 -0
  83. package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +58 -0
  84. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -1
  85. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -1
  86. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +38 -14
  87. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +9 -10
  88. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +1 -1
  89. package/dataflow/internal/process/functions/call/known-call-handling.js +4 -3
  90. package/dataflow/internal/process/functions/call/named-call-handling.js +6 -0
  91. package/dataflow/origin/dfg-get-origin.d.ts +1 -1
  92. package/dataflow/origin/dfg-get-origin.js +1 -1
  93. package/dataflow/processor.d.ts +6 -0
  94. package/documentation/data/faq/faqs.d.ts +2 -1
  95. package/documentation/data/faq/faqs.js +75 -57
  96. package/documentation/data/server/doc-data-server-messages.d.ts +2 -1
  97. package/documentation/data/server/doc-data-server-messages.js +15 -7
  98. package/documentation/doc-readme.js +15 -15
  99. package/documentation/doc-util/doc-cfg.d.ts +3 -1
  100. package/documentation/doc-util/doc-cfg.js +3 -3
  101. package/documentation/doc-util/doc-dfg.d.ts +3 -1
  102. package/documentation/doc-util/doc-dfg.js +3 -3
  103. package/documentation/doc-util/doc-files.d.ts +3 -1
  104. package/documentation/doc-util/doc-files.js +9 -6
  105. package/documentation/doc-util/doc-normalized-ast.d.ts +3 -1
  106. package/documentation/doc-util/doc-normalized-ast.js +2 -2
  107. package/documentation/doc-util/doc-query.d.ts +2 -1
  108. package/documentation/doc-util/doc-query.js +2 -2
  109. package/documentation/doc-util/doc-repl.js +1 -0
  110. package/documentation/doc-util/doc-types.d.ts +6 -6
  111. package/documentation/doc-util/doc-types.js +11 -9
  112. package/documentation/issue-linting-rule.js +1 -2
  113. package/documentation/wiki-analyzer.js +9 -9
  114. package/documentation/wiki-cfg.js +40 -41
  115. package/documentation/wiki-core.js +119 -31
  116. package/documentation/wiki-create-linting-rules.d.ts +6 -0
  117. package/documentation/wiki-create-linting-rules.js +95 -0
  118. package/documentation/wiki-dataflow-graph.js +77 -76
  119. package/documentation/wiki-engine.js +1 -2
  120. package/documentation/wiki-faq.d.ts +2 -1
  121. package/documentation/wiki-faq.js +4 -4
  122. package/documentation/wiki-interface.js +19 -6
  123. package/documentation/wiki-linter.d.ts +1 -1
  124. package/documentation/wiki-linter.js +14 -6
  125. package/documentation/wiki-linting-and-testing.js +2 -2
  126. package/documentation/wiki-mk/doc-context.d.ts +3 -3
  127. package/documentation/wiki-mk/doc-maker.d.ts +2 -0
  128. package/documentation/wiki-mk/doc-maker.js +7 -1
  129. package/documentation/wiki-normalized-ast.js +5 -5
  130. package/documentation/wiki-onboarding.d.ts +2 -1
  131. package/documentation/wiki-onboarding.js +5 -5
  132. package/documentation/wiki-overview.js +3 -3
  133. package/documentation/wiki-query.js +85 -84
  134. package/documentation/wiki-search.js +4 -5
  135. package/documentation/wiki-setup.js +6 -7
  136. package/gas.d.ts +74 -0
  137. package/gas.js +18 -0
  138. package/linter/linter-executor.js +2 -8
  139. package/linter/linter-format.d.ts +4 -11
  140. package/linter/linter-rules.d.ts +88 -86
  141. package/linter/linter-rules.js +7 -1
  142. package/linter/rules/absolute-path.d.ts +2 -7
  143. package/linter/rules/absolute-path.js +6 -4
  144. package/linter/rules/dataframe-access-validation.d.ts +1 -6
  145. package/linter/rules/dataframe-access-validation.js +8 -6
  146. package/linter/rules/dead-code.d.ts +2 -11
  147. package/linter/rules/dead-code.js +16 -11
  148. package/linter/rules/deprecated-functions.d.ts +3 -3
  149. package/linter/rules/file-path-validity.d.ts +1 -6
  150. package/linter/rules/file-path-validity.js +5 -5
  151. package/linter/rules/function-finder-util.d.ts +7 -11
  152. package/linter/rules/function-finder-util.js +9 -6
  153. package/linter/rules/naming-convention.d.ts +2 -7
  154. package/linter/rules/naming-convention.js +3 -2
  155. package/linter/rules/network-functions.d.ts +2 -7
  156. package/linter/rules/network-functions.js +14 -12
  157. package/linter/rules/no-leaked-credentials.d.ts +36 -0
  158. package/linter/rules/no-leaked-credentials.js +75 -0
  159. package/linter/rules/problematic-inputs.d.ts +1 -8
  160. package/linter/rules/problematic-inputs.js +5 -4
  161. package/linter/rules/roxygen-arguments.d.ts +2 -7
  162. package/linter/rules/roxygen-arguments.js +13 -20
  163. package/linter/rules/seeded-randomness.d.ts +2 -7
  164. package/linter/rules/seeded-randomness.js +7 -4
  165. package/linter/rules/software-has-license.d.ts +31 -0
  166. package/linter/rules/software-has-license.js +46 -0
  167. package/linter/rules/software-has-tests.d.ts +38 -0
  168. package/linter/rules/software-has-tests.js +48 -0
  169. package/linter/rules/stop-with-call-arg.d.ts +2 -7
  170. package/linter/rules/stop-with-call-arg.js +3 -2
  171. package/linter/rules/unused-definition.d.ts +3 -8
  172. package/linter/rules/unused-definition.js +7 -5
  173. package/linter/rules/useless-loop.d.ts +2 -7
  174. package/linter/rules/useless-loop.js +5 -2
  175. package/package.json +3 -2
  176. package/project/context/flowr-analyzer-context.d.ts +13 -14
  177. package/project/context/flowr-analyzer-context.js +4 -0
  178. package/project/context/flowr-analyzer-files-context.d.ts +12 -0
  179. package/project/context/flowr-analyzer-files-context.js +12 -2
  180. package/project/context/flowr-analyzer-gas-context.d.ts +28 -0
  181. package/project/context/flowr-analyzer-gas-context.js +101 -0
  182. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +13 -7
  183. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +56 -11
  184. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
  185. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +2 -2
  186. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -1
  187. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +5 -5
  188. package/project/plugins/flowr-analyzer-plugin.d.ts +15 -8
  189. package/project/plugins/flowr-analyzer-plugin.js +14 -7
  190. package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.d.ts +19 -0
  191. package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.js +35 -0
  192. package/project/plugins/plugin-registry.d.ts +2 -1
  193. package/project/plugins/plugin-registry.js +3 -1
  194. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +22 -0
  195. package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +47 -0
  196. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +1 -1
  197. package/queries/catalog/call-context-query/call-context-query-executor.js +54 -8
  198. package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -2
  199. package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
  200. package/queries/catalog/dependencies-query/function-info/test-functions.js +18 -177
  201. package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
  202. package/queries/catalog/dice-query/dice-query-executor.d.ts +8 -0
  203. package/queries/catalog/dice-query/dice-query-executor.js +52 -0
  204. package/queries/catalog/dice-query/dice-query-format.d.ts +53 -0
  205. package/queries/catalog/dice-query/dice-query-format.js +102 -0
  206. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
  207. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
  208. package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -0
  209. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
  210. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -0
  211. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
  212. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -0
  213. package/queries/catalog/linter-query/linter-query-executor.js +7 -0
  214. package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
  215. package/queries/catalog/location-map-query/location-map-query-format.js +1 -0
  216. package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
  217. package/queries/catalog/origin-query/origin-query-format.js +1 -0
  218. package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
  219. package/queries/catalog/provenance-query/provenance-query-format.js +1 -0
  220. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
  221. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -0
  222. package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
  223. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -0
  224. package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
  225. package/queries/query.d.ts +18 -1
  226. package/queries/query.js +3 -1
  227. package/r-bridge/data/data.d.ts +5 -0
  228. package/r-bridge/data/data.js +6 -0
  229. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +0 -1
  230. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.d.ts +1 -1
  231. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -1
  232. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.d.ts +1 -1
  233. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -1
  234. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +55 -44
  235. package/r-bridge/parser.js +2 -9
  236. package/r-bridge/shell.d.ts +8 -1
  237. package/r-bridge/shell.js +26 -7
  238. package/search/flowr-search-builder.d.ts +2 -2
  239. package/search/flowr-search-builder.js +1 -1
  240. package/search/flowr-search-filters.d.ts +30 -9
  241. package/search/flowr-search-filters.js +26 -21
  242. package/search/search-executor/search-enrichers.d.ts +600 -0
  243. package/search/search-executor/search-enrichers.js +23 -2
  244. package/slicing/static/static-slicer.d.ts +39 -11
  245. package/slicing/static/static-slicer.js +44 -14
  246. package/util/collections/queue.d.ts +16 -0
  247. package/util/collections/queue.js +38 -0
  248. package/util/log.d.ts +1 -1
  249. package/util/log.js +1 -1
  250. package/util/mermaid/dfg.d.ts +2 -2
  251. package/util/mermaid/dfg.js +2 -2
  252. package/util/objects.d.ts +9 -0
  253. package/util/objects.js +54 -0
  254. package/util/proc.d.ts +6 -0
  255. package/util/proc.js +20 -0
  256. package/util/version.js +1 -1
@@ -47,7 +47,7 @@ const input_sources_query_executor_1 = require("../queries/catalog/input-sources
47
47
  shortDescription: 'Finds all calls in a set of files that matches specified criteria.',
48
48
  functionName: call_context_query_executor_1.executeCallContextQueries.name,
49
49
  functionFile: '../queries/catalog/call-context-query/call-context-query-executor.ts',
50
- buildExplanation: async (shell) => {
50
+ buildExplanation: async (shell, ctx) => {
51
51
  return `
52
52
  Call context queries can be used to identify calls to specific functions that match criteria of your interest.
53
53
  For now, we support two criteria:
@@ -89,7 +89,7 @@ ${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode,
89
89
  subkind: 'plot',
90
90
  linkTo: { type: 'link-to-last-call', callName: '^plot$' }
91
91
  }
92
- ], { showCode: false })}
92
+ ], { showCode: false, ctx })}
93
93
 
94
94
  As you can see, all kinds and subkinds with the same name are grouped together.
95
95
  Yet, re-stating common arguments and kinds may be cumbersome (although you can already use clever regex patterns).
@@ -105,7 +105,7 @@ my_test_function()
105
105
  `.trim();
106
106
  return (0, doc_structure_1.details)('Alias Example', `Consider the following code: ${(0, doc_code_1.codeBlock)('r', code)}\nNow let's say we want to query _all_ uses of the \`my_test_function\`:` + await (0, doc_query_1.showQuery)(shell, code, [
107
107
  { type: 'call-context', callName: '^my_test_function', includeAliases: true }
108
- ], { showCode: false }));
108
+ ], { showCode: false, ctx }));
109
109
  })()}
110
110
  `;
111
111
  }
@@ -116,16 +116,16 @@ my_test_function()
116
116
  shortDescription: 'Returns the dataflow graph of the given code.',
117
117
  functionName: dataflow_query_executor_1.executeDataflowQuery.name,
118
118
  functionFile: '../queries/catalog/dataflow-query/dataflow-query-executor.ts',
119
- buildExplanation: async (shell) => {
119
+ buildExplanation: async (shell, ctx) => {
120
120
  const exampleCode = 'x + 1';
121
121
  return `
122
- Maybe you want to handle only the result of the query execution, or you just need the [dataflow graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph) again.
122
+ Maybe you want to handle only the result of the query execution, or you just need the ${ctx.linkPage('wiki/Dataflow Graph', 'dataflow graph')} again.
123
123
  This query type does exactly that!
124
124
 
125
125
  Using the example code \`${exampleCode}\`, the following query returns the dataflow graph of the code:
126
126
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
127
127
  type: 'dataflow'
128
- }], { showCode: true, collapseQuery: true })}
128
+ }], { showCode: true, collapseQuery: true, ctx })}
129
129
  `;
130
130
  }
131
131
  });
@@ -143,7 +143,7 @@ This query calculates and returns the ${ctx.linkPage('wiki/Dataflow Graph', 'cal
143
143
  Using the example code \`${exampleCode}\`, the following query returns the dataflow graph of the code:
144
144
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
145
145
  type: 'call-graph'
146
- }], { showCode: true, collapseQuery: true })}
146
+ }], { showCode: true, collapseQuery: true, ctx })}
147
147
  `;
148
148
  }
149
149
  });
@@ -153,7 +153,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
153
153
  shortDescription: 'Checks whether a function calls another function matching given constraints.',
154
154
  functionName: does_call_query_executor_1.executeDoesCallQuery.name,
155
155
  functionFile: '../queries/catalog/does-call-query/does-call-query-executor.ts',
156
- buildExplanation: async (shell) => {
156
+ buildExplanation: async (shell, ctx) => {
157
157
  const exampleCode = 'f <- function(x) { eval(x) };\nf("1 + 1")';
158
158
  return `
159
159
  This query checks whether a function calls another function matching given constraints.
@@ -166,7 +166,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
166
166
  queryId: 'calls-eval',
167
167
  call: '2@f',
168
168
  calls: { type: 'name', name: 'eval', nameExact: true }
169
- }], { showCode: true, collapseQuery: false, shorthand: '(2@f:"eval")' })}
169
+ }], { showCode: true, collapseQuery: false, shorthand: '(2@f:"eval")', ctx })}
170
170
  `;
171
171
  }
172
172
  });
@@ -176,12 +176,12 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
176
176
  shortDescription: 'Returns the files matching the given criteria.',
177
177
  functionName: files_query_executor_1.executeFileQuery.name,
178
178
  functionFile: '../queries/catalog/files-query/files-query-executor.ts',
179
- buildExplanation: async (shell) => {
179
+ buildExplanation: async (shell, ctx) => {
180
180
  return `
181
181
  This query returns the files that match the given criteria.
182
182
  ${await (0, doc_query_1.showQuery)(shell, '', [{
183
183
  type: 'files'
184
- }], { showCode: true, collapseQuery: true })}
184
+ }], { showCode: true, collapseQuery: true, ctx })}
185
185
  `;
186
186
  }
187
187
  });
@@ -191,7 +191,7 @@ ${await (0, doc_query_1.showQuery)(shell, '', [{
191
191
  shortDescription: 'Returns information about the analyzed project',
192
192
  functionName: dataflow_query_executor_1.executeDataflowQuery.name,
193
193
  functionFile: '../queries/catalog/project-query/project-query-executor.ts',
194
- buildExplanation: async (shell) => {
194
+ buildExplanation: async (shell, ctx) => {
195
195
  const exampleCode = 'x + 1';
196
196
  return `
197
197
  This query returns the information about the analyzed project.
@@ -199,7 +199,7 @@ If present, it will incorporate plugins to, e.g., extract author and license inf
199
199
 
200
200
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
201
201
  type: 'project'
202
- }], { showCode: true, collapseQuery: true })}
202
+ }], { showCode: true, collapseQuery: true, ctx })}
203
203
  `;
204
204
  }
205
205
  });
@@ -209,16 +209,16 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
209
209
  shortDescription: 'Returns the normalized AST of the given code.',
210
210
  functionName: normalized_ast_query_executor_1.executeNormalizedAstQuery.name,
211
211
  functionFile: '../queries/catalog/normalized-ast-query/normalized-ast-query-executor.ts',
212
- buildExplanation: async (shell) => {
212
+ buildExplanation: async (shell, ctx) => {
213
213
  const exampleCode = 'x + 1';
214
214
  return `
215
- Maybe you want to handle only the result of the query execution, or you just need the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized%20AST) again.
215
+ Maybe you want to handle only the result of the query execution, or you just need the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')} again.
216
216
  This query type does exactly that!
217
217
 
218
218
  Using the example code \`${exampleCode}\`, the following query returns the normalized AST of the code:
219
219
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
220
220
  type: 'normalized-ast'
221
- }], { showCode: true, collapseQuery: true })}
221
+ }], { showCode: true, collapseQuery: true, ctx })}
222
222
  `;
223
223
  }
224
224
  });
@@ -228,7 +228,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
228
228
  shortDescription: 'Calculates and returns all the clusters present in the dataflow graph.',
229
229
  functionName: cluster_query_executor_1.executeDataflowClusterQuery.name,
230
230
  functionFile: '../queries/catalog/cluster-query/cluster-query-executor.ts',
231
- buildExplanation: async (shell) => {
231
+ buildExplanation: async (shell, ctx) => {
232
232
  const exampleA = 'x <- 1; x';
233
233
  const exampleB = 'x <- 1; y';
234
234
  return `
@@ -239,13 +239,13 @@ edges in both directions. From this perspective,
239
239
  the code \`${exampleA}\` has one cluster (given that all code is related),
240
240
  while the code \`${exampleB}\` has two clusters (given that the \`y\` has no relation to the previous definition).
241
241
 
242
- ${(0, doc_structure_1.details)('Example <code>' + exampleA + '</code>', await (0, doc_query_1.showQuery)(shell, exampleA, [{ type: 'dataflow-cluster' }], { showCode: false }))}
243
- ${(0, doc_structure_1.details)('Example <code>' + exampleB + '</code>', await (0, doc_query_1.showQuery)(shell, exampleB, [{ type: 'dataflow-cluster' }], { showCode: false }))}
242
+ ${(0, doc_structure_1.details)('Example <code>' + exampleA + '</code>', await (0, doc_query_1.showQuery)(shell, exampleA, [{ type: 'dataflow-cluster' }], { showCode: false, ctx }))}
243
+ ${(0, doc_structure_1.details)('Example <code>' + exampleB + '</code>', await (0, doc_query_1.showQuery)(shell, exampleB, [{ type: 'dataflow-cluster' }], { showCode: false, ctx }))}
244
244
 
245
245
  Using the example code from above, the following query returns all clusters:
246
246
  ${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode, [{
247
247
  type: 'dataflow-cluster'
248
- }], { showCode: false, collapseQuery: true })}
248
+ }], { showCode: false, collapseQuery: true, ctx })}
249
249
  `;
250
250
  }
251
251
  });
@@ -255,18 +255,18 @@ ${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode,
255
255
  shortDescription: 'Provides access to flowR\'s value tracking (which is configurable)',
256
256
  functionName: search_query_executor_1.executeSearch.name,
257
257
  functionFile: '../queries/catalog/resolve-value-query/resolve-value-query-executor.ts',
258
- buildExplanation: async (shell) => {
258
+ buildExplanation: async (shell, ctx) => {
259
259
  const exampleCode = 'x <- 1\ny <-2\nprint(x)\nprint(y)';
260
260
  const criteria = ['3@x', '4@y'];
261
261
  return `
262
262
  With this query you can use flowR's value-tracking capabilities to resolve identifiers to all potential values they may have at runtime (if possible).
263
- The extent to which flowR traces values (e.g., built-ins vs. constants) can be configured in flowR's Configuration file (see the [Interface](${doc_files_1.FlowrWikiBaseRef}/Interface) wiki page for more information).
263
+ The extent to which flowR traces values (e.g., built-ins vs. constants) can be configured in flowR's Configuration file (see the ${ctx.linkPage('wiki/Interface', 'Interface')} wiki page for more information).
264
264
 
265
265
  Using the example code \`${exampleCode}\` (with newlines), the following query returns all values of \`x\` in the code:
266
266
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
267
267
  type: 'resolve-value',
268
268
  criteria: criteria
269
- }], { showCode: true, shorthand: (0, doc_query_1.sliceQueryShorthand)(criteria, (0, doc_escape_1.escapeNewline)(exampleCode)) })}
269
+ }], { showCode: true, shorthand: (0, doc_query_1.sliceQueryShorthand)(criteria, (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
270
270
  `;
271
271
  }
272
272
  });
@@ -276,7 +276,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
276
276
  shortDescription: 'Determine whether functions are higher-order functions',
277
277
  functionName: inspect_higher_order_query_executor_1.executeHigherOrderQuery.name,
278
278
  functionFile: '../queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.ts',
279
- buildExplanation: async (shell) => {
279
+ buildExplanation: async (shell, ctx) => {
280
280
  const exampleCode = 'f <- function() function(x) x; f()';
281
281
  return `
282
282
  With this query you can identify which functions in the code are higher-order functions, i.e., either take a function as an argument or return a function.
@@ -285,13 +285,13 @@ Please note, that functions that are just identities (e.g., \`function(x) x\`) a
285
285
  Using the example code \`${exampleCode}\` the following query returns the information for all identified function definitions whether they are higher-order functions:
286
286
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
287
287
  type: 'inspect-higher-order',
288
- }], { showCode: true, collapseQuery: true })}
288
+ }], { showCode: true, collapseQuery: true, ctx })}
289
289
 
290
290
  This query also supports a slicing criterion based query mode that only returns information for functions matching the given criteria:
291
291
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
292
292
  type: 'inspect-higher-order',
293
293
  filter: ['1@function']
294
- }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)(['1@function'], (0, doc_escape_1.escapeNewline)(exampleCode)) })}
294
+ }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)(['1@function'], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
295
295
  `;
296
296
  }
297
297
  });
@@ -301,7 +301,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
301
301
  shortDescription: 'Determine whether functions are recursive',
302
302
  functionName: inspect_recursion_query_executor_1.executeRecursionQuery.name,
303
303
  functionFile: '../queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.ts',
304
- buildExplanation: async (shell) => {
304
+ buildExplanation: async (shell, ctx) => {
305
305
  const exampleCode = 'fact <- function(n) { if(n <= 1) 1 else n * fact(n - 1) }';
306
306
  return `
307
307
  With this query you can identify which functions in the code are recursive.
@@ -310,13 +310,13 @@ Please note, that functions that *may* be recursive due to indirect calls are al
310
310
  Using the example code \`${exampleCode}\` the following query returns the information for all identified function definitions whether they are recursive:
311
311
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
312
312
  type: 'inspect-recursion',
313
- }], { showCode: true, collapseQuery: true })}
313
+ }], { showCode: true, collapseQuery: true, ctx })}
314
314
 
315
315
  This query also supports a slicing criterion based query mode that only returns information for functions matching the given criteria:
316
316
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
317
317
  type: 'inspect-recursion',
318
318
  filter: ['1@function']
319
- }], { showCode: true, shorthand: (0, doc_query_1.sliceQueryShorthand)(['1@function'], (0, doc_escape_1.escapeNewline)(exampleCode)) })}
319
+ }], { showCode: true, shorthand: (0, doc_query_1.sliceQueryShorthand)(['1@function'], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
320
320
  `;
321
321
  }
322
322
  });
@@ -326,7 +326,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
326
326
  shortDescription: 'Determine whether functions throw exceptions (known to flowR)',
327
327
  functionName: inspect_exception_query_executor_1.executeExceptionQuery.name,
328
328
  functionFile: '../queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.ts',
329
- buildExplanation: async (shell) => {
329
+ buildExplanation: async (shell, ctx) => {
330
330
  const exampleCode = `mayFail <- function(x) {
331
331
  if(x < 0) stop("Negative value!")
332
332
  else sqrt(x)
@@ -345,7 +345,7 @@ ${(0, doc_code_1.codeBlock)('r', exampleCode)}
345
345
  the following query returns the information for all identified function definitions whether they throw exceptions:
346
346
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
347
347
  type: 'inspect-exception',
348
- }], { showCode: true, collapseQuery: true })}
348
+ }], { showCode: true, collapseQuery: true, ctx })}
349
349
  `;
350
350
  }
351
351
  });
@@ -355,7 +355,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
355
355
  shortDescription: 'Retrieve the origin of a variable, function call, ...',
356
356
  functionName: search_query_executor_1.executeSearch.name,
357
357
  functionFile: '../queries/catalog/origin-query/origin-query-executor.ts',
358
- buildExplanation: async (shell) => {
358
+ buildExplanation: async (shell, ctx) => {
359
359
  const exampleCode = 'x <- 1\nprint(x)';
360
360
  const criterion = '2@x';
361
361
  return `
@@ -366,7 +366,7 @@ Using the example code \`${exampleCode}\` (with the \`print(x)\` in the second l
366
366
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
367
367
  type: 'origin',
368
368
  criterion: criterion
369
- }], { showCode: true, shorthand: (0, doc_query_1.sliceQueryShorthand)([criterion], (0, doc_escape_1.escapeNewline)(exampleCode)) })}
369
+ }], { showCode: true, shorthand: (0, doc_query_1.sliceQueryShorthand)([criterion], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
370
370
  `;
371
371
  }
372
372
  });
@@ -376,16 +376,16 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
376
376
  shortDescription: 'Provides access to flowR\'s search API',
377
377
  functionName: search_query_executor_1.executeSearch.name,
378
378
  functionFile: '../queries/catalog/search-query/search-query-executor.ts',
379
- buildExplanation: async (shell) => {
379
+ buildExplanation: async (shell, ctx) => {
380
380
  const exampleCode = 'x + 1';
381
381
  return `
382
- With this query you can use the [Search API](${doc_files_1.FlowrWikiBaseRef}/Search%20API) to conduct searches on the flowR analysis result.
382
+ With this query you can use the ${ctx.linkPage('wiki/Search API', 'Search API')} to conduct searches on the flowR analysis result.
383
383
 
384
384
  Using the example code \`${exampleCode}\`, the following query returns all uses of 'x' in the code:
385
385
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
386
386
  type: 'search',
387
387
  search: flowr_search_builder_1.Q.var('x').filter(vertex_1.VertexType.Use).build()
388
- }], { showCode: true, collapseQuery: false })}
388
+ }], { showCode: true, collapseQuery: false, ctx })}
389
389
  `;
390
390
  }
391
391
  });
@@ -395,7 +395,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
395
395
  shortDescription: 'Check whether one normalized AST node happens before another in the CFG.',
396
396
  functionName: search_query_executor_1.executeSearch.name,
397
397
  functionFile: '../queries/catalog/happens-before-query/happens-before-query-executor.ts',
398
- buildExplanation: async (shell) => {
398
+ buildExplanation: async (shell, ctx) => {
399
399
  const exampleCode = 'x <- 1\ny <- 2';
400
400
  return `
401
401
  With this query you can analyze the control flow graph:
@@ -409,7 +409,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
409
409
  type: 'happens-before',
410
410
  a: '1@x',
411
411
  b: '2@y'
412
- }], { showCode: true, collapseQuery: false })}
412
+ }], { showCode: true, collapseQuery: false, ctx })}
413
413
  `;
414
414
  }
415
415
  });
@@ -419,15 +419,15 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
419
419
  shortDescription: 'Returns the id-map of the normalized AST of the given code.',
420
420
  functionName: id_map_query_executor_1.executeIdMapQuery.name,
421
421
  functionFile: '../queries/catalog/id-map-query/id-map-query-executor.ts',
422
- buildExplanation: async (shell) => {
422
+ buildExplanation: async (shell, ctx) => {
423
423
  const exampleCode = 'x + 1';
424
424
  return `
425
- This query provides access to all nodes in the [normalized AST](${doc_files_1.FlowrWikiBaseRef}/Normalized%20AST) as a mapping from their id to the node itself.
425
+ This query provides access to all nodes in the ${ctx.linkPage('wiki/Normalized AST', 'normalized AST')} as a mapping from their id to the node itself.
426
426
 
427
427
  Using the example code \`${exampleCode}\`, the following query returns all nodes from the code:
428
428
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
429
429
  type: 'id-map'
430
- }], { showCode: true, collapseQuery: true })}
430
+ }], { showCode: true, collapseQuery: true, ctx })}
431
431
  `;
432
432
  }
433
433
  });
@@ -437,16 +437,16 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
437
437
  shortDescription: 'Returns the current configuration of flowR.',
438
438
  functionName: config_query_executor_1.executeConfigQuery.name,
439
439
  functionFile: '../queries/catalog/config-query/config-query-format.ts',
440
- buildExplanation: async (shell) => {
440
+ buildExplanation: async (shell, ctx) => {
441
441
  return `
442
- This query provides access to the current configuration of the flowR instance. See the [Interface](${doc_files_1.FlowrWikiBaseRef}/Interface) wiki page for more information on what the configuration represents.
442
+ This query provides access to the current configuration of the flowR instance. See the ${ctx.linkPage('wiki/Interface', 'Interface')} wiki page for more information on what the configuration represents.
443
443
  Additionally, you can use this query to update the configuration of flowR on-the-fly (please do not rely on this mechanism it is mostly of interest for demonstrations).
444
444
  ${await (0, doc_query_1.showQuery)(shell, '', [{
445
445
  type: 'config',
446
446
  update: {
447
447
  ignoreSourceCalls: true
448
448
  }
449
- }], { showCode: false, collapseQuery: true, collapseResult: true })}
449
+ }], { showCode: false, collapseQuery: true, collapseResult: true, ctx })}
450
450
 
451
451
  Please note that, in the REPL, a special syntax starting with \`+\` (which should be autocompleted) can be used to update the configuration on the fly:
452
452
 
@@ -468,20 +468,20 @@ enables quick statistics after each REPL command. Likewise, setting \`repl.dfPro
468
468
  shortDescription: 'Returns the shapes inferred for all dataframes in the code.',
469
469
  functionName: df_shape_query_executor_1.executeDfShapeQuery.name,
470
470
  functionFile: '../queries/catalog/df-shape-query/df-shape-query-format.ts',
471
- buildExplanation: async (shell) => {
471
+ buildExplanation: async (shell, ctx) => {
472
472
  const exampleCode = 'x <- data.frame(a=1:3)\nfilter(x, FALSE)';
473
473
  const criterion = '2@x';
474
474
  return `
475
475
  This query infers all shapes of dataframes within the code. For example, you can use:
476
476
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
477
477
  type: 'df-shape'
478
- }], { showCode: true, collapseQuery: true })}
478
+ }], { showCode: true, collapseQuery: true, ctx })}
479
479
 
480
480
  The query also accepts an optional slice criterion to narrow the results to a specific node. For example:
481
481
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
482
482
  type: 'df-shape',
483
483
  criterion: criterion
484
- }], { showCode: true, collapseQuery: true, shorthand: (0, doc_query_1.sliceQueryShorthand)([criterion], (0, doc_escape_1.escapeNewline)(exampleCode)) })}
484
+ }], { showCode: true, collapseQuery: true, shorthand: (0, doc_query_1.sliceQueryShorthand)([criterion], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
485
485
  `;
486
486
  }
487
487
  });
@@ -491,7 +491,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
491
491
  shortDescription: 'Combines multiple queries of the same type into one, specifying common arguments.',
492
492
  functionName: compound_query_1.executeCompoundQueries.name,
493
493
  functionFile: '../queries/virtual-query/compound-query.ts',
494
- buildExplanation: async (shell) => {
494
+ buildExplanation: async (shell, ctx) => {
495
495
  return `
496
496
  A compound query comes in use, whenever we want to state multiple queries of the same type with a set of common arguments.
497
497
  It offers the following properties of interest:
@@ -511,13 +511,13 @@ ${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode,
511
511
  { callName: '^mean$' },
512
512
  { callName: '^print$' }
513
513
  ]
514
- }], { showCode: false })}
514
+ }], { showCode: false, ctx })}
515
515
 
516
516
  Of course, in this specific scenario, the following query would be equivalent:
517
517
 
518
518
  ${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode, [
519
519
  { type: 'call-context', callName: '^(mean|print)$', kind: 'visualize', subkind: 'text' }
520
- ], { showCode: false, collapseResult: true })}
520
+ ], { showCode: false, collapseResult: true, ctx })}
521
521
 
522
522
  However, compound queries become more useful whenever common arguments can not be expressed as a union in one of their properties.
523
523
  Additionally, you can still overwrite default arguments.
@@ -532,7 +532,7 @@ ${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode,
532
532
  { callName: '^mean$' },
533
533
  { callName: '^print$', callTargets: identify_link_to_last_call_relation_1.CallTargets.OnlyLocal }
534
534
  ]
535
- }], { showCode: false })}
535
+ }], { showCode: false, ctx })}
536
536
 
537
537
  Now, the results no longer contain calls to \`plot\` that are not defined locally.
538
538
 
@@ -545,12 +545,12 @@ Now, the results no longer contain calls to \`plot\` that are not defined locall
545
545
  shortDescription: 'Slice the dataflow graph reducing the code to just the parts relevant for the given criteria (backward and forward).',
546
546
  functionName: static_slice_query_executor_1.executeStaticSliceQuery.name,
547
547
  functionFile: '../queries/catalog/static-slice-query/static-slice-query-executor.ts',
548
- buildExplanation: async (shell) => {
548
+ buildExplanation: async (shell, ctx) => {
549
549
  const exampleCode = 'x <- 1\ny <- 2\nz <- 3\nx';
550
550
  const criteria = ['3@z', '4@x'];
551
551
  return `
552
552
  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
- 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).
553
+ 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).
554
554
  Given this, the backward slice is essentially the subpart of the program that may influence the value of the variables you are interested in.
555
555
  To specify a variable of interest, you have to present flowR with a [slicing criterion](${doc_files_1.FlowrWikiBaseRef}/Terminology#slicing-criterion) (or, respectively, an array of them).
556
556
 
@@ -561,7 +561,7 @@ If you are interested in the parts required for the use of \`x\` in the last lin
561
561
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
562
562
  type: 'static-slice',
563
563
  criteria: criteria
564
- }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)(criteria, (0, doc_escape_1.escapeNewline)(exampleCode)) })}
564
+ }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)(criteria, (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
565
565
 
566
566
  In general, you may be uninterested in seeing the reconstructed version and want to save some computation time, for this,
567
567
  you can use the \`noReconstruction\` flag.
@@ -570,7 +570,7 @@ ${(0, doc_structure_1.details)('No Reconstruction Example', await (0, doc_query_
570
570
  type: 'static-slice',
571
571
  criteria: ['4@x'],
572
572
  noReconstruction: true
573
- }], { showCode: false }))}
573
+ }], { showCode: false, ctx }))}
574
574
 
575
575
  Likewise, if you want the forward slice for the first use of \`x\`, you can do it like this:
576
576
 
@@ -578,10 +578,10 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
578
578
  type: 'static-slice',
579
579
  criteria: ['1@x'],
580
580
  direction: slice_direction_1.SliceDirection.Forward
581
- }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)(['1@x'], (0, doc_escape_1.escapeNewline)(exampleCode), true) })}
581
+ }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)(['1@x'], (0, doc_escape_1.escapeNewline)(exampleCode), true), ctx })}
582
582
 
583
- You can disable [magic comments](${doc_files_1.FlowrWikiBaseRef}/Interface#slice-magic-comments) using the \`noMagicComments\` flag.
584
- This query replaces the old [\`request-slice\`](${doc_files_1.FlowrWikiBaseRef}/Interface#message-request-slice) message.
583
+ You can disable ${ctx.linkPage('wiki/Interface', 'magic comments', 'slice-magic-comments')} using the \`noMagicComments\` flag.
584
+ This query replaces the old ${ctx.linkPage('wiki/Interface', '`request-slice`', 'message-request-slice')} message.
585
585
  `;
586
586
  }
587
587
  });
@@ -591,7 +591,7 @@ This query replaces the old [\`request-slice\`](${doc_files_1.FlowrWikiBaseRef}/
591
591
  shortDescription: 'Calculate the provenance of a given variable, optionally restricted to its enveloping fdef',
592
592
  functionName: provenance_query_executor_1.executeProvenanceQuery.name,
593
593
  functionFile: '../queries/catalog/provenance-query/provenance-query-executor.ts',
594
- buildExplanation: async (shell) => {
594
+ buildExplanation: async (shell, ctx) => {
595
595
  const exampleCode = 'x <- 1\ny <- 2\nz <- 3\nx';
596
596
  const criterion = '4@x';
597
597
  return `
@@ -605,7 +605,7 @@ If you are interested in the provenance of the \`x\` in the last line you can us
605
605
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
606
606
  type: 'provenance',
607
607
  criterion
608
- }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)([criterion], (0, doc_escape_1.escapeNewline)(exampleCode)) })}
608
+ }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)([criterion], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
609
609
  `;
610
610
  }
611
611
  });
@@ -615,7 +615,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
615
615
  shortDescription: 'Classify the input sources of function calls',
616
616
  functionName: input_sources_query_executor_1.executeInputSourcesQuery.name,
617
617
  functionFile: '../queries/catalog/input-sources-query/input-sources-query-executor.ts',
618
- buildExplanation: async (shell) => {
618
+ buildExplanation: async (shell, ctx) => {
619
619
  const exampleCode = `
620
620
  f <- function(x) {
621
621
  x <- x * 2
@@ -633,7 +633,7 @@ If you are interested in the input-sources of the \`print\` call, you can use:
633
633
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
634
634
  type: 'input-sources',
635
635
  criterion
636
- }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)([criterion], (0, doc_escape_1.escapeNewline)(exampleCode)) })}
636
+ }], { showCode: false, shorthand: (0, doc_query_1.sliceQueryShorthand)([criterion], (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
637
637
  `;
638
638
  }
639
639
  });
@@ -643,7 +643,7 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
643
643
  shortDescription: 'Returns all direct dependencies (in- and outputs) of a given R script',
644
644
  functionName: dependencies_query_executor_1.executeDependenciesQuery.name,
645
645
  functionFile: '../queries/catalog/dependencies-query/dependencies-query-executor.ts',
646
- buildExplanation: async (shell) => {
646
+ buildExplanation: async (shell, ctx) => {
647
647
  const exampleCode = 'library(x)';
648
648
  const longerCode = `
649
649
  source("sample.R")
@@ -659,12 +659,12 @@ print("hello world!")
659
659
  `;
660
660
  return `
661
661
  This query extracts all dependencies from an R script, using a combination of a ${(0, doc_query_1.linkToQueryOfName)('call-context')}
662
- and more advanced tracking in the [Dataflow Graph](${doc_files_1.FlowrWikiBaseRef}/Dataflow%20Graph).
662
+ and more advanced tracking in the ${ctx.linkPage('wiki/Dataflow Graph', 'Dataflow Graph')}.
663
663
 
664
664
  In other words, if you have a script simply reading: \`${exampleCode}\`, the following query returns the loaded library:
665
665
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
666
666
  type: 'dependencies'
667
- }], { showCode: false, collapseQuery: true })}
667
+ }], { showCode: false, collapseQuery: true, ctx })}
668
668
 
669
669
  Of course, this works for more complicated scripts too. The query offers information on the loaded _libraries_, _sourced_ files, data which is _read_ and data which is _written_.
670
670
  For example, consider the following script:
@@ -672,7 +672,7 @@ ${(0, doc_code_1.codeBlock)('r', longerCode)}
672
672
  The following query returns the dependencies of the script.
673
673
  ${await (0, doc_query_1.showQuery)(shell, longerCode, [{
674
674
  type: 'dependencies'
675
- }], { showCode: false, collapseQuery: true, collapseResult: true })}
675
+ }], { showCode: false, collapseQuery: true, collapseResult: true, ctx })}
676
676
 
677
677
  Currently, the dependency extraction may fail as it is essentially a set of heuristics guessing the dependencies.
678
678
  We welcome any feedback on this (consider opening a [new issue](${doc_issue_1.NewIssueUrl})).
@@ -684,7 +684,7 @@ ${await (0, doc_query_1.showQuery)(shell, longerCode, [{
684
684
  ignoreDefaultFunctions: true,
685
685
  enabledCategories: ['library'],
686
686
  libraryFunctions: [{ package: 'base', name: 'print', argIdx: 0, argName: 'library', resolveValue: true }],
687
- }], { showCode: false, collapseQuery: false, collapseResult: true })}
687
+ }], { showCode: false, collapseQuery: false, collapseResult: true, ctx })}
688
688
 
689
689
  Here, \`resolveValue\` tells the dependency query to resolve the value of this argument in case it is not a constant.
690
690
  `;
@@ -696,7 +696,7 @@ Here, \`resolveValue\` tells the dependency query to resolve the value of this a
696
696
  shortDescription: 'Lints a given R script for common issues.',
697
697
  functionName: dependencies_query_executor_1.executeDependenciesQuery.name,
698
698
  functionFile: '../queries/catalog/linter-query/linter-query-executor.ts',
699
- buildExplanation: async (shell) => {
699
+ buildExplanation: async (shell, ctx) => {
700
700
  const exampleCode = 'read.csv("i_do_not_exist.csv")';
701
701
  return `
702
702
  This query lints a given R script for common issues, such as missing files, unused variables, and more.
@@ -704,7 +704,7 @@ This query lints a given R script for common issues, such as missing files, unus
704
704
  In other words, if you have a script simply reading: \`${exampleCode}\`, the following query returns all smells detected:
705
705
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
706
706
  type: 'linter'
707
- }], { showCode: false, collapseQuery: true })}
707
+ }], { showCode: false, collapseQuery: true, ctx })}
708
708
 
709
709
  You can also configure which rules to apply and what settings to use for these rules:
710
710
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
@@ -713,7 +713,8 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
713
713
  }], {
714
714
  showCode: false,
715
715
  collapseQuery: true,
716
- shorthand: `rules:file-path-validity "${exampleCode}"`
716
+ shorthand: `rules:file-path-validity "${exampleCode}"`,
717
+ ctx
717
718
  })}
718
719
 
719
720
  We welcome any feedback and suggestions for new rules on this (consider opening a [new issue](${doc_issue_1.NewIssueUrl})).
@@ -726,7 +727,7 @@ We welcome any feedback and suggestions for new rules on this (consider opening
726
727
  shortDescription: 'Provides the control-flow of the program.',
727
728
  functionName: control_flow_query_executor_1.executeControlFlowQuery.name,
728
729
  functionFile: '../queries/catalog/control-flow-query/control-flow-query-executor.ts',
729
- buildExplanation: async (shell) => {
730
+ buildExplanation: async (shell, ctx) => {
730
731
  const exampleCode = 'if(TRUE) 1 else 2';
731
732
  return `
732
733
  This control-flow query provides you access to the control flow graph.
@@ -734,7 +735,7 @@ This control-flow query provides you access to the control flow graph.
734
735
  In other words, if you have a script simply reading: \`${exampleCode}\`, the following query returns the CFG:
735
736
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
736
737
  type: 'control-flow'
737
- }], { showCode: false, collapseQuery: true, collapseResult: true })}
738
+ }], { showCode: false, collapseQuery: true, collapseResult: true, ctx })}
738
739
 
739
740
  You can also overwrite the simplification passes to tune the perspective. for example, if you want to have basic blocks:
740
741
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
@@ -742,11 +743,11 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
742
743
  config: {
743
744
  simplificationPasses: ['unique-cf-sets', 'to-basic-blocks']
744
745
  }
745
- }], { showCode: false, collapseResult: true })}
746
+ }], { showCode: false, collapseResult: true, ctx })}
746
747
 
747
748
  this produces:
748
749
 
749
- ${await (0, doc_cfg_1.printCfgCode)(shell, exampleCode, { showCode: false, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'] })}
750
+ ${await (0, doc_cfg_1.printCfgCode)(shell, exampleCode, { showCode: false, prefix: 'flowchart RL\n', simplifications: ['to-basic-blocks'], ctx })}
750
751
 
751
752
 
752
753
  If, on the other hand, you want to prune dead code edges:
@@ -755,11 +756,11 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
755
756
  config: {
756
757
  simplificationPasses: ['unique-cf-sets', 'analyze-dead-code']
757
758
  }
758
- }], { showCode: false, collapseResult: true })}
759
+ }], { showCode: false, collapseResult: true, ctx })}
759
760
 
760
761
  this produces:
761
762
 
762
- ${await (0, doc_cfg_1.printCfgCode)(shell, exampleCode, { showCode: false, prefix: 'flowchart RL\n', simplifications: ['analyze-dead-code'] })}
763
+ ${await (0, doc_cfg_1.printCfgCode)(shell, exampleCode, { showCode: false, prefix: 'flowchart RL\n', simplifications: ['analyze-dead-code'], ctx })}
763
764
 
764
765
 
765
766
  Or, completely remove dead code:
@@ -768,11 +769,11 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
768
769
  config: {
769
770
  simplificationPasses: ['unique-cf-sets', 'analyze-dead-code', 'remove-dead-code']
770
771
  }
771
- }], { showCode: false, collapseResult: true })}
772
+ }], { showCode: false, collapseResult: true, ctx })}
772
773
 
773
774
  this produces:
774
775
 
775
- ${await (0, doc_cfg_1.printCfgCode)(shell, exampleCode, { showCode: false, prefix: 'flowchart RL\n', simplifications: ['analyze-dead-code', 'remove-dead-code'] })}
776
+ ${await (0, doc_cfg_1.printCfgCode)(shell, exampleCode, { showCode: false, prefix: 'flowchart RL\n', simplifications: ['analyze-dead-code', 'remove-dead-code'], ctx })}
776
777
 
777
778
  `;
778
779
  }
@@ -798,14 +799,14 @@ The following query then gives you the aforementioned mapping:
798
799
 
799
800
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
800
801
  type: 'location-map'
801
- }], { showCode: false, collapseQuery: true })}
802
+ }], { showCode: false, collapseQuery: true, ctx })}
802
803
 
803
804
  The query also accepts a list of slice criteria to filter the results to only include the locations of specific nodes. For example:
804
805
 
805
806
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
806
807
  type: 'location-map',
807
808
  ids: criteria
808
- }], { showCode: false, collapseQuery: true, shorthand: (0, doc_query_1.sliceQueryShorthand)(criteria, (0, doc_escape_1.escapeNewline)(exampleCode)) })}
809
+ }], { showCode: false, collapseQuery: true, shorthand: (0, doc_query_1.sliceQueryShorthand)(criteria, (0, doc_escape_1.escapeNewline)(exampleCode)), ctx })}
809
810
 
810
811
  All locations are given as a ${ctx.link('SourceRange')} paired with the file id in the format \`[file-id, [start-line, start-column, end-line, end-column]]\`.
811
812
 
@@ -828,8 +829,8 @@ ${(0, doc_structure_1.block)({
828
829
  type: 'NOTE',
829
830
  content: `
830
831
  There are many ways to query a dataflow graph created by flowR.
831
- For example, you can use the [\`request-query\`](${doc_files_1.FlowrWikiBaseRef}/Interface#message-request-query) message
832
- with a running flowR server, or the ${(0, doc_cli_option_1.getReplCommand)('query')} command in the flowR [REPL](${doc_files_1.FlowrWikiBaseRef}/Interface#repl).
832
+ For example, you can use the ${ctx.linkPage('wiki/Interface', '`request-query`', 'message-request-query')} message
833
+ with a running flowR server, or the ${(0, doc_cli_option_1.getReplCommand)('query')} command in the flowR ${ctx.linkPage('wiki/Interface', 'REPL', 'repl')}.
833
834
 
834
835
  Also, check out the [${doc_files_1.FlowrGithubGroupName}/sample-analyzer-project-query](${doc_files_1.FlowrGithubBaseRef}/sample-analyzer-project-query) repository for a complete example project using the query API.
835
836
  `.trim()
@@ -873,7 +874,7 @@ ${example_query_code_1.exampleQueryCode}
873
874
 
874
875
  <details> <summary>Dataflow Graph of the Example</summary>
875
876
 
876
- ${await (0, doc_dfg_1.printDfGraphForCode)(shell, example_query_code_1.exampleQueryCode, { showCode: false })}
877
+ ${await (0, doc_dfg_1.printDfGraphForCode)(shell, example_query_code_1.exampleQueryCode, { showCode: false, ctx })}
877
878
 
878
879
  </details>
879
880
 
@@ -892,7 +893,7 @@ For the specific use-case stated, you could use the ${(0, doc_query_1.linkToQuer
892
893
 
893
894
  Just as an example, the following ${(0, doc_query_1.linkToQueryOfName)('call-context')} finds all calls to \`read_csv\` that are not overwritten:
894
895
 
895
- ${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode, [{ type: 'call-context', callName: '^read_csv$', callTargets: identify_link_to_last_call_relation_1.CallTargets.OnlyGlobal, kind: 'input', subkind: 'csv-file' }], { showCode: false })}
896
+ ${await (0, doc_query_1.showQuery)(shell, example_query_code_1.exampleQueryCode, [{ type: 'call-context', callName: '^read_csv$', callTargets: identify_link_to_last_call_relation_1.CallTargets.OnlyGlobal, kind: 'input', subkind: 'csv-file' }], { showCode: false, ctx })}
896
897
 
897
898
  ${await (0, doc_query_1.explainQueries)(shell, ctx, 'active')}
898
899