@eagleoutice/flowr 2.16.5 → 2.16.7

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 (316) hide show
  1. package/README.md +21 -15
  2. package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +2 -0
  3. package/abstract-interpretation/data-frame/dataframe-semantics.js +3 -1
  4. package/abstract-interpretation/data-frame/resolve-args.d.ts +1 -7
  5. package/abstract-interpretation/data-frame/resolve-args.js +2 -11
  6. package/cli/repl/commands/repl-cfg.js +5 -19
  7. package/cli/repl/commands/repl-code-command.d.ts +10 -0
  8. package/cli/repl/commands/repl-code-command.js +18 -0
  9. package/cli/repl/commands/repl-dataflow.js +34 -59
  10. package/cli/repl/commands/repl-normalize.js +24 -41
  11. package/cli/repl/commands/repl-query.js +10 -17
  12. package/config.js +3 -3
  13. package/control-flow/cfg-dead-code.js +15 -2
  14. package/control-flow/useless-loop.js +1 -2
  15. package/data/r-base-packages.generated.d.ts +1 -1
  16. package/data/r-base-packages.generated.js +3 -3
  17. package/dataflow/environments/ambient-state-name.d.ts +80 -0
  18. package/dataflow/environments/ambient-state-name.js +113 -0
  19. package/dataflow/environments/built-in-eval-name.d.ts +3 -1
  20. package/dataflow/environments/built-in-eval-name.js +2 -0
  21. package/dataflow/environments/built-in-props.d.ts +27 -7
  22. package/dataflow/environments/built-in-props.js +59 -44
  23. package/dataflow/environments/built-in.d.ts +5 -2
  24. package/dataflow/environments/built-in.js +22 -5
  25. package/dataflow/environments/default-builtin-config.d.ts +538 -14
  26. package/dataflow/environments/default-builtin-config.js +189 -123
  27. package/dataflow/environments/environment.d.ts +7 -1
  28. package/dataflow/environments/environment.js +19 -1
  29. package/dataflow/environments/identifier.d.ts +11 -0
  30. package/dataflow/eval/resolve/alias-tracking.d.ts +13 -3
  31. package/dataflow/eval/resolve/alias-tracking.js +66 -37
  32. package/dataflow/eval/resolve/resolve-argument.d.ts +4 -2
  33. package/dataflow/eval/resolve/resolve-argument.js +23 -11
  34. package/dataflow/eval/resolve/resolve.d.ts +5 -0
  35. package/dataflow/eval/resolve/resolve.js +25 -3
  36. package/dataflow/eval/values/r-value.d.ts +4 -2
  37. package/dataflow/eval/values/r-value.js +3 -1
  38. package/dataflow/eval/values/string/string-constants.d.ts +7 -1
  39. package/dataflow/eval/values/string/string-constants.js +38 -36
  40. package/dataflow/extractor.js +105 -2
  41. package/dataflow/fn/argument-roles.js +22 -8
  42. package/dataflow/fn/function-semantics.d.ts +3 -2
  43. package/dataflow/fn/strict-function.js +13 -2
  44. package/dataflow/graph/df-helper.d.ts +14 -1
  45. package/dataflow/graph/df-helper.js +37 -4
  46. package/dataflow/graph/graph.d.ts +6 -0
  47. package/dataflow/graph/graph.js +6 -0
  48. package/dataflow/internal/linker.d.ts +4 -1
  49. package/dataflow/internal/linker.js +11 -7
  50. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.d.ts +41 -0
  51. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-keys.js +88 -0
  52. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +19 -44
  53. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +125 -158
  54. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +6 -1
  55. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +35 -9
  56. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +10 -1
  57. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +4 -1
  58. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +6 -1
  59. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +1 -1
  60. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +3 -2
  61. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +7 -0
  62. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +21 -12
  63. package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +1 -1
  64. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +8 -1
  65. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +3 -0
  66. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +5 -0
  67. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -2
  68. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +11 -12
  69. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
  70. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +6 -0
  71. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +1 -1
  72. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +7 -0
  73. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +42 -0
  74. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +11 -0
  75. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +29 -4
  76. package/dataflow/internal/process/functions/call/common.js +3 -4
  77. package/dataflow/internal/process/functions/call/deferred.d.ts +3 -2
  78. package/dataflow/internal/process/functions/call/deferred.js +17 -9
  79. package/dataflow/internal/process/functions/call/quoted.js +1 -1
  80. package/documentation/doc-capabilities.js +3 -2
  81. package/documentation/doc-readme.js +1 -2
  82. package/documentation/doc-util/doc-dfg.js +2 -2
  83. package/documentation/doc-util/doc-query.d.ts +3 -1
  84. package/documentation/doc-util/doc-query.js +4 -4
  85. package/documentation/wiki-create-linting-rules.js +1 -1
  86. package/documentation/wiki-linter.js +16 -206
  87. package/documentation/wiki-linting-and-testing.js +31 -64
  88. package/documentation/wiki-query.js +41 -0
  89. package/index.d.ts +1 -0
  90. package/index.js +5 -1
  91. package/linter/linter-format.d.ts +6 -0
  92. package/linter/linter-format.js +10 -0
  93. package/linter/linter-rules.d.ts +155 -103
  94. package/linter/linter-rules.js +2 -0
  95. package/linter/linter-util.d.ts +23 -0
  96. package/linter/linter-util.js +58 -0
  97. package/linter/rules/absolute-path.d.ts +2 -2
  98. package/linter/rules/absolute-path.js +1 -4
  99. package/linter/rules/cmd-check/bogus-return.d.ts +2 -2
  100. package/linter/rules/cmd-check/bogus-return.js +3 -7
  101. package/linter/rules/cmd-check/call-arguments.d.ts +2 -2
  102. package/linter/rules/cmd-check/class-string-comparison.d.ts +2 -2
  103. package/linter/rules/cmd-check/class-string-comparison.js +3 -7
  104. package/linter/rules/cmd-check/cmd-check-util.d.ts +8 -9
  105. package/linter/rules/cmd-check/cmd-check-util.js +14 -26
  106. package/linter/rules/cmd-check/compiled-code.d.ts +8 -3
  107. package/linter/rules/cmd-check/compiled-code.js +3 -13
  108. package/linter/rules/cmd-check/dependency-declaration.d.ts +2 -2
  109. package/linter/rules/cmd-check/dependency-declaration.js +6 -7
  110. package/linter/rules/cmd-check/description-metadata.d.ts +4 -4
  111. package/linter/rules/cmd-check/documentation-mismatch.d.ts +2 -2
  112. package/linter/rules/cmd-check/documentation-mismatch.js +4 -11
  113. package/linter/rules/cmd-check/file-checks.d.ts +19 -6
  114. package/linter/rules/cmd-check/file-checks.js +13 -5
  115. package/linter/rules/cmd-check/foreign-function-calls.d.ts +2 -2
  116. package/linter/rules/cmd-check/global-environment-modification.d.ts +2 -2
  117. package/linter/rules/cmd-check/global-environment-modification.js +3 -2
  118. package/linter/rules/cmd-check/namespace-tampering.d.ts +2 -2
  119. package/linter/rules/cmd-check/namespace-tampering.js +9 -9
  120. package/linter/rules/cmd-check/non-ascii-code.d.ts +2 -2
  121. package/linter/rules/cmd-check/package-data.d.ts +11 -5
  122. package/linter/rules/cmd-check/package-data.js +5 -12
  123. package/linter/rules/cmd-check/package-files.js +4 -10
  124. package/linter/rules/cmd-check/package-hooks.d.ts +2 -2
  125. package/linter/rules/cmd-check/package-hooks.js +10 -8
  126. package/linter/rules/cmd-check/package-metafiles.d.ts +8 -3
  127. package/linter/rules/cmd-check/package-metafiles.js +3 -12
  128. package/linter/rules/cmd-check/package-runtime.d.ts +18 -5
  129. package/linter/rules/cmd-check/package-runtime.js +64 -20
  130. package/linter/rules/cmd-check/package-structure.d.ts +11 -5
  131. package/linter/rules/cmd-check/package-structure.js +4 -12
  132. package/linter/rules/cmd-check/rd-files.d.ts +8 -3
  133. package/linter/rules/cmd-check/rd-files.js +4 -14
  134. package/linter/rules/cmd-check/s-three-method-consistency.d.ts +2 -2
  135. package/linter/rules/cmd-check/s-three-method-consistency.js +3 -4
  136. package/linter/rules/cmd-check/true-false-abbreviation.d.ts +2 -2
  137. package/linter/rules/dataframe-access-validation.d.ts +2 -2
  138. package/linter/rules/dataframe-access-validation.js +5 -8
  139. package/linter/rules/dead-code.d.ts +5 -4
  140. package/linter/rules/dead-code.js +25 -14
  141. package/linter/rules/deprecated-functions.d.ts +3 -3
  142. package/linter/rules/deprecated-functions.js +16 -23
  143. package/linter/rules/file-path-validity.d.ts +2 -2
  144. package/linter/rules/file-path-validity.js +3 -6
  145. package/linter/rules/function-finder-util.d.ts +3 -3
  146. package/linter/rules/function-finder-util.js +7 -14
  147. package/linter/rules/namespace-access.d.ts +2 -2
  148. package/linter/rules/namespace-access.js +6 -9
  149. package/linter/rules/naming-convention.d.ts +2 -2
  150. package/linter/rules/naming-convention.js +1 -4
  151. package/linter/rules/network-functions.d.ts +3 -3
  152. package/linter/rules/no-leaked-credentials.d.ts +2 -2
  153. package/linter/rules/no-leaked-credentials.js +1 -4
  154. package/linter/rules/overwritten-file.d.ts +38 -0
  155. package/linter/rules/overwritten-file.js +102 -0
  156. package/linter/rules/problematic-inputs.d.ts +16 -6
  157. package/linter/rules/problematic-inputs.js +78 -34
  158. package/linter/rules/roxygen-arguments.d.ts +2 -2
  159. package/linter/rules/roxygen-arguments.js +1 -4
  160. package/linter/rules/seeded-randomness.d.ts +3 -3
  161. package/linter/rules/seeded-randomness.js +6 -23
  162. package/linter/rules/software-has-license.d.ts +2 -2
  163. package/linter/rules/software-has-license.js +1 -4
  164. package/linter/rules/software-has-tests.d.ts +2 -2
  165. package/linter/rules/software-has-tests.js +1 -4
  166. package/linter/rules/stop-with-call-arg.d.ts +2 -2
  167. package/linter/rules/stop-with-call-arg.js +4 -11
  168. package/linter/rules/syntactically-valid.d.ts +4 -2
  169. package/linter/rules/syntactically-valid.js +29 -10
  170. package/linter/rules/unclosed-connection.d.ts +2 -2
  171. package/linter/rules/unclosed-connection.js +1 -4
  172. package/linter/rules/undefined-symbol.d.ts +2 -2
  173. package/linter/rules/undefined-symbol.js +25 -22
  174. package/linter/rules/unescaped-arguments.d.ts +2 -2
  175. package/linter/rules/unescaped-arguments.js +1 -4
  176. package/linter/rules/unused-definition.d.ts +2 -2
  177. package/linter/rules/unused-definition.js +37 -25
  178. package/linter/rules/unused-import.d.ts +2 -2
  179. package/linter/rules/unused-import.js +9 -14
  180. package/linter/rules/useless-loop.d.ts +7 -6
  181. package/linter/rules/useless-loop.js +4 -8
  182. package/package.json +5 -3
  183. package/project/cache/flowr-analyzer-cache.d.ts +2 -0
  184. package/project/cache/flowr-analyzer-cache.js +15 -11
  185. package/project/context/flowr-analyzer-files-context.d.ts +3 -0
  186. package/project/context/flowr-analyzer-files-context.js +6 -0
  187. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +6 -1
  188. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +35 -0
  189. package/project/plugins/file-plugins/files/flowr-namespace-file.js +2 -1
  190. package/project/plugins/file-plugins/files/flowr-rsession-file.d.ts +26 -0
  191. package/project/plugins/file-plugins/files/flowr-rsession-file.js +44 -0
  192. package/project/plugins/file-plugins/files/r-session.d.ts +20 -0
  193. package/project/plugins/file-plugins/files/r-session.js +58 -0
  194. package/project/plugins/file-plugins/files/recorded-runs.d.ts +18 -0
  195. package/project/plugins/file-plugins/files/recorded-runs.js +8 -0
  196. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rsession-file-plugin.d.ts +20 -0
  197. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rsession-file-plugin.js +28 -0
  198. package/project/plugins/plugin-registry.d.ts +2 -1
  199. package/project/plugins/plugin-registry.js +2 -0
  200. package/project/sigdb/spec-query.d.ts +73 -0
  201. package/project/sigdb/spec-query.js +339 -0
  202. package/queries/base-query-format.d.ts +1 -1
  203. package/queries/base-query-format.js +2 -2
  204. package/queries/catalog/absint-query/absint-query-executor.js +3 -6
  205. package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -0
  206. package/queries/catalog/call-context-query/call-context-query-executor.js +113 -73
  207. package/queries/catalog/call-graph-query/call-graph-query-executor.js +2 -3
  208. package/queries/catalog/cluster-query/cluster-query-executor.js +2 -3
  209. package/queries/catalog/config-query/config-query-format.d.ts +0 -1
  210. package/queries/catalog/config-query/config-query-format.js +1 -2
  211. package/queries/catalog/control-flow-query/control-flow-query-executor.js +2 -3
  212. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-executor.js +2 -4
  213. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +0 -1
  214. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +1 -2
  215. package/queries/catalog/dataflow-query/dataflow-query-executor.js +2 -3
  216. package/queries/catalog/dependencies-query/dependencies-query-executor.d.ts +7 -0
  217. package/queries/catalog/dependencies-query/dependencies-query-executor.js +72 -42
  218. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +24 -6
  219. package/queries/catalog/dependencies-query/dependencies-query-format.js +108 -3
  220. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +6 -1
  221. package/queries/catalog/dependencies-query/function-info/read-functions.js +6 -6
  222. package/queries/catalog/dependencies-query/function-info/write-functions.js +13 -7
  223. package/queries/catalog/dependencies-query/implicit-echo.js +21 -7
  224. package/queries/catalog/dice-query/dice-query-executor.js +2 -3
  225. package/queries/catalog/does-call-query/does-call-query-executor.js +2 -3
  226. package/queries/catalog/files-query/files-query-executor.js +2 -3
  227. package/queries/catalog/function-info-query/function-info-query-executor.js +2 -1
  228. package/queries/catalog/function-info-query/function-info-query-format.d.ts +0 -2
  229. package/queries/catalog/function-info-query/function-info-query-format.js +1 -2
  230. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +3 -2
  231. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +0 -2
  232. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +1 -2
  233. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -3
  234. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +0 -1
  235. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -2
  236. package/queries/catalog/id-map-query/id-map-query-executor.js +2 -3
  237. package/queries/catalog/id-map-query/id-map-query-format.d.ts +0 -1
  238. package/queries/catalog/id-map-query/id-map-query-format.js +1 -2
  239. package/queries/catalog/input-sources-query/input-sources-query-executor.js +3 -4
  240. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +2 -1
  241. package/queries/catalog/input-sources-query/simple-input-classifier.js +60 -13
  242. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -3
  243. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +2 -3
  244. package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +2 -1
  245. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.d.ts +3 -2
  246. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -7
  247. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +6 -9
  248. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +8 -33
  249. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.d.ts +3 -2
  250. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +1 -7
  251. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +6 -7
  252. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +8 -31
  253. package/queries/catalog/linter-query/linter-query-executor.js +2 -3
  254. package/queries/catalog/location-map-query/location-map-query-executor.js +2 -3
  255. package/queries/catalog/location-map-query/location-map-query-format.d.ts +0 -1
  256. package/queries/catalog/location-map-query/location-map-query-format.js +1 -2
  257. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +2 -3
  258. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +0 -1
  259. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +1 -2
  260. package/queries/catalog/origin-query/origin-query-executor.d.ts +0 -5
  261. package/queries/catalog/origin-query/origin-query-executor.js +3 -11
  262. package/queries/catalog/project-query/project-query-executor.js +23 -7
  263. package/queries/catalog/project-query/project-query-format.d.ts +5 -0
  264. package/queries/catalog/project-query/project-query-format.js +20 -2
  265. package/queries/catalog/provenance-query/provenance-query-executor.js +2 -3
  266. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -3
  267. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +0 -1
  268. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -2
  269. package/queries/catalog/search-query/search-query-executor.js +2 -3
  270. package/queries/catalog/signature-query/signature-query-executor.js +39 -0
  271. package/queries/catalog/signature-query/signature-query-format.d.ts +7 -1
  272. package/queries/catalog/signature-query/signature-query-format.js +15 -1
  273. package/queries/catalog/signature-query/signature-query-render.js +2 -1
  274. package/queries/catalog/static-slice-query/static-slice-query-executor.js +2 -3
  275. package/queries/query-function-property.d.ts +28 -0
  276. package/queries/query-function-property.js +48 -0
  277. package/queries/query-meta.d.ts +3 -0
  278. package/queries/query-meta.js +8 -0
  279. package/queries/query.d.ts +13 -18
  280. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +2 -2
  281. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +4 -3
  282. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +6 -0
  283. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +9 -0
  284. package/r-bridge/lang-4.x/ast/model/syntax-version.d.ts +8 -0
  285. package/r-bridge/lang-4.x/ast/model/syntax-version.js +49 -0
  286. package/r-bridge/lang-4.x/ast/model/type.d.ts +2 -0
  287. package/r-bridge/lang-4.x/ast/model/type.js +3 -0
  288. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +4 -1
  289. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-single-node.js +1 -0
  290. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +1 -1
  291. package/reconstruct/reconstruct.js +35 -1
  292. package/search/search-executor/search-generators.js +1 -1
  293. package/slicing/static/fingerprint.js +7 -3
  294. package/slicing/static/removal-slice.js +4 -2
  295. package/slicing/static/static-slicer.js +6 -0
  296. package/util/assert.js +2 -2
  297. package/util/collections/arrays.d.ts +4 -0
  298. package/util/collections/arrays.js +11 -0
  299. package/util/collections/defaultmap.d.ts +5 -1
  300. package/util/collections/defaultmap.js +6 -1
  301. package/util/files.js +26 -5
  302. package/util/flowr-version.d.ts +10 -0
  303. package/util/flowr-version.js +20 -0
  304. package/util/glob.js +6 -4
  305. package/util/r-regex.d.ts +6 -0
  306. package/util/r-regex.js +17 -0
  307. package/util/text/args.d.ts +5 -0
  308. package/util/text/args.js +28 -22
  309. package/util/text/name-rank.d.ts +2 -0
  310. package/util/text/name-rank.js +3 -1
  311. package/util/text/regex.d.ts +10 -0
  312. package/util/text/regex.js +29 -0
  313. package/util/version.d.ts +1 -6
  314. package/util/version.js +6 -14
  315. package/documentation/doc-util/doc-functions.d.ts +0 -24
  316. package/documentation/doc-util/doc-functions.js +0 -65
package/README.md CHANGED
@@ -38,7 +38,7 @@ It offers a wide variety of features, for example:
38
38
 
39
39
  ```shell
40
40
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
41
- flowR repl v2.16.3, R grammar v14 (tree-sitter engine)
41
+ flowR repl v2.16.6, R grammar v14 (tree-sitter engine)
42
42
  R> :query @linter "read.csv(\"/root/x.txt\")"
43
43
  ```
44
44
 
@@ -46,11 +46,15 @@ It offers a wide variety of features, for example:
46
46
  <summary style='color:gray'>Output</summary>
47
47
 
48
48
  ```text
49
- Query: linter (18 ms)
49
+ Query: linter (6 ms)
50
50
  ╰ Deprecated Functions (deprecated-functions): no findings
51
- ╰ File Path Validity (file-path-validity): no findings
51
+ ╰ File Path Validity (file-path-validity):
52
+ ╰ certain:
53
+ ╰ Path `/root/x.txt` at 1.1-23
52
54
  ╰ Seeded Randomness (seeded-randomness): no findings
53
- ╰ Absolute Paths (absolute-file-paths): no findings
55
+ ╰ Absolute Paths (absolute-file-paths):
56
+ ╰ certain:
57
+ ╰ Path `/root/x.txt` at 1.1-23
54
58
  ╰ Unused Definitions (unused-definitions): no findings
55
59
  ╰ Network Functions (network-functions): no findings
56
60
  ╰ Dataframe Access Validation (dataframe-access-validation): no findings
@@ -63,9 +67,10 @@ It offers a wide variety of features, for example:
63
67
  ╰ Undefined Symbol (undefined-symbol): no findings
64
68
  ╰ Unused Import (unused-import): no findings
65
69
  ╰ Unclosed Connection (unclosed-connection): no findings
70
+ ╰ Overwritten File (overwritten-file): no findings
66
71
  ╰ Unescaped Arguments (unescaped-arguments): no findings
67
72
  ╰ Namespace Access Validity (namespace-access): no findings
68
- All queries together required ≈18 ms (1ms accuracy, total 18 ms)
73
+ All queries together required ≈6 ms (1ms accuracy, total 6 ms)
69
74
  ```
70
75
 
71
76
  The linter will analyze the code and return any issues found.
@@ -79,7 +84,7 @@ It offers a wide variety of features, for example:
79
84
 
80
85
  _Results (prettified and summarized):_
81
86
 
82
- Query: **linter** (30 ms)\
87
+ Query: **linter** (12 ms)\
83
88
  &nbsp;&nbsp;&nbsp;╰ **Deprecated Functions** (deprecated-functions): _no findings_\
84
89
  &nbsp;&nbsp;&nbsp;╰ **File Path Validity** (file-path-validity):\
85
90
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;╰ certain:\
@@ -100,16 +105,16 @@ It offers a wide variety of features, for example:
100
105
  &nbsp;&nbsp;&nbsp;╰ **Undefined Symbol** (undefined-symbol): _no findings_\
101
106
  &nbsp;&nbsp;&nbsp;╰ **Unused Import** (unused-import): _no findings_\
102
107
  &nbsp;&nbsp;&nbsp;╰ **Unclosed Connection** (unclosed-connection): _no findings_\
108
+ &nbsp;&nbsp;&nbsp;╰ **Overwritten File** (overwritten-file): _no findings_\
103
109
  &nbsp;&nbsp;&nbsp;╰ **Unescaped Arguments** (unescaped-arguments): _no findings_\
104
110
  &nbsp;&nbsp;&nbsp;╰ **Namespace Access Validity** (namespace-access): _no findings_\
105
- _All queries together required ≈30 ms (1ms accuracy, total 30 ms)_
111
+ _All queries together required ≈12 ms (1ms accuracy, total 12 ms)_
106
112
 
107
113
  <details> <summary style="color:gray">Show Detailed Results as Json</summary>
108
114
 
109
115
  The analysis ran (including parsing and normalization and the query) within the generation environment.
110
116
 
111
- In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR.
112
- Please consult the [Interface](https://github.com/flowr-analysis/flowr/wiki/Interface) wiki page for more information on how to get those.
117
+ The JSON contains the ids of the nodes in question (see the [Interface](https://github.com/flowr-analysis/flowr/wiki/Interface) wiki page).
113
118
 
114
119
  ```json
115
120
  {
@@ -144,6 +149,7 @@ It offers a wide variety of features, for example:
144
149
  },
145
150
  "unused-import": {"results":[],".meta":{"totalConsidered":0,"totalUnresolved":0,"totalMultiPackage":0,"totalUnused":0}},
146
151
  "unclosed-connection": {"results":[],".meta":{"totalOpened":0,"totalClosed":0}},
152
+ "overwritten-file": {"results":[],".meta":{"totalFiles":0}},
147
153
  "unescaped-arguments": {"results":[],".meta":{"totalCriticalArguments":0,"totalEscapedArguments":0}},
148
154
  "namespace-access": {"results":[],".meta":{"unresolved":0}}
149
155
  },
@@ -162,7 +168,7 @@ It offers a wide variety of features, for example:
162
168
  * 🍕 **program slicing**\
163
169
  Given a point of interest like the visualization of a plot, _flowR_ reduces the program to just the parts which are relevant
164
170
  for the computation of the point of interest.
165
- (&nbsp;[▶&nbsp;Explore in Browser](https://flowr-analysis.github.io/flowr/wiki/playground/#c=zM4VwtgBAPAtBAMAoADgJwPYBMQGMAu0cAjIgO6EQDsiAchUUogGbqoQAUAlhJwHYREAXOxowiASnEQA3oggRQkWAvAQA1D3URSciGiy4Cy-dnwQAVD0QBfRIhwBDPOwBEAZXCCXAGhVhfLgA6vC7i9k6uAAoYpnheviaGAcGhiEA&h=slice&f=deps&v=,,d&p=11:13 "run the slicing example in flowR's playground, no setup")&nbsp;)
171
+ (&nbsp;[▶&nbsp;Explore in Browser](https://flowr-analysis.github.io/flowr/wiki/playground/#c=zM4VwtgBAPAtBAMAoADgJwPYBMQGMAu0cAjIgO6EQDsiAchUUogGbqoQAUAlhJwHYREAXOxowiASnEQA3oggRQkWAvAQA1D3URSciGiy4Cy-dnwQAVD0QBfRIhwBDPOwBEAZXCCXAGhVhfLgA6vC7i9k6uAAoYpnheviaGAcGhiEA&h=slice&f=deps&p=11:13 "run the slicing example in flowR's playground, no setup")&nbsp;)
166
172
 
167
173
  <details><summary>Example: Slicing with flowR</summary>
168
174
 
@@ -193,7 +199,7 @@ It offers a wide variety of features, for example:
193
199
 
194
200
  ```shell
195
201
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
196
- flowR repl v2.16.3, R grammar v14 (tree-sitter engine)
202
+ flowR repl v2.16.6, R grammar v14 (tree-sitter engine)
197
203
  R> :query @static-slice (11@sum) file://test/testfiles/example.R
198
204
  ```
199
205
 
@@ -206,7 +212,7 @@ It offers a wide variety of features, for example:
206
212
  N <- 10
207
213
  for(i in 1:(N-1)) sum <- sum + i + w
208
214
  sum
209
- All queries together required ≈6 ms (1ms accuracy, total 6 ms)
215
+ All queries together required ≈2 ms (1ms accuracy, total 2 ms)
210
216
  ```
211
217
 
212
218
  </details>
@@ -214,7 +220,7 @@ It offers a wide variety of features, for example:
214
220
  </details>
215
221
 
216
222
  * 🚀 **fast call-graph, data-, and control-flow graphs**\
217
- Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">137.3 ms</span></i> (as of Oct 19, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
223
+ Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">102.8 ms</span></i> (as of Oct 22, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
218
224
  _flowR_ can analyze the data- and control-flow of the average real-world R&nbsp;script. See the [benchmarks](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark) for more information,
219
225
  and consult the [wiki pages](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) for more details on the [dataflow graphs](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) as well as [call graphs](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph#perspectives-cg).
220
226
  (&nbsp;[▶&nbsp;Explore in Browser](https://flowr-analysis.github.io/flowr/wiki/playground/#c=zDYSwRgTghhCeAUATADsWECUAoLBnAxlMAKYD6ALgPakC2UAHgAQA8AtIwGYCuAdvuSEo949DIyYB6RnXojsWaAHdGKlW0aIo5KADoO0GsXghEjALyMAjAC4AbABpGANyJdi5xvngBmRwA5HAHZHACZHAE5HABYMbHwSKB5VdQ4QYHJiCHglRxdgN0YAPkYQuISeABICImJTdWqSCmoZeHjiRIq8t3lcLho6OFJcbXJcFnZe-pgQXCM2xMdDRI8l4Qba2KxeLlnEJu1gNQm%2B7KhFTtdieUUIEAydfFwneEmB2CGR3EcAIleYWAeT2%2B2FQlHIrXKVUIJEQIMoIB4owh7UqJgwQA&p=13:1 "run this script in flowR's playground, no setup")&nbsp;)
@@ -245,7 +251,7 @@ It offers a wide variety of features, for example:
245
251
 
246
252
  ```shell
247
253
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
248
- flowR repl v2.16.3, R grammar v14 (tree-sitter engine)
254
+ flowR repl v2.16.6, R grammar v14 (tree-sitter engine)
249
255
  R> :dataflow* test/testfiles/example.R
250
256
  ```
251
257
 
@@ -549,7 +555,7 @@ It offers a wide variety of features, for example:
549
555
  linkStyle 107 stroke:gray;
550
556
  ```
551
557
 
552
- (The analysis ran (including parse and normalize, using the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment. No [signature database](https://github.com/flowr-analysis/flowr/wiki/Signature-Database) is mounted for these generated graphs, so `library()` calls attach no package exports; base-R names are still qualified via the generated base-package store (e.g. `acf` as `stats::acf`).)
558
+ (The analysis ran (parse and normalize with the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) in the generation environment. No [signature database](https://github.com/flowr-analysis/flowr/wiki/Signature-Database) is mounted, so `library()` attaches no exports (base-R names are still qualified, e.g., `stats::acf`).)
553
559
 
554
560
  </details>
555
561
 
@@ -11,6 +11,8 @@ type DataFrameStateDomain = StateDomain<DataFrameDomain>;
11
11
  * A map storing the abstract data frame operations that the expressions of the analyzed program are mapped to.
12
12
  */
13
13
  export type DataFrameOperationMap = Map<NodeId, readonly DataFrameOperation[]>;
14
+ /** the functions the shape inference knows to return a data frame, qualified as `pkg::name`, like `utils::read.csv` */
15
+ export declare const DataFrameFunctions: ReadonlySet<string>;
14
16
  /**
15
17
  * The options of the abstract semantics of the data frame shape inference (see {@link DataFrameShapeSemantics}).
16
18
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DataFrameShapeSemantics = void 0;
3
+ exports.DataFrameShapeSemantics = exports.DataFrameFunctions = void 0;
4
4
  const config_1 = require("../../config");
5
5
  const built_in_proc_name_1 = require("../../dataflow/environments/built-in-proc-name");
6
6
  const resolve_helper_1 = require("../../dataflow/environments/resolve-helper");
@@ -403,6 +403,8 @@ const DataFrameSemantics = {
403
403
  },
404
404
  conditionSemantics: {}
405
405
  };
406
+ /** the functions the shape inference knows to return a data frame, qualified as `pkg::name`, like `utils::read.csv` */
407
+ exports.DataFrameFunctions = new Set(Object.keys(DataFrameSemantics.functionCalls));
406
408
  /**
407
409
  * The abstract semantics of the data frame shape inference, applying the abstract semantics defined for the supported
408
410
  * data frame functions, access operations, and replacement functions (see {@link DataFrameSemantics}).
@@ -34,13 +34,7 @@ export declare function unquoteArgument(argument: undefined): undefined;
34
34
  export declare function unquoteArgument(argument: string): string;
35
35
  export declare function unquoteArgument(argument: string | undefined): string | undefined;
36
36
  /**
37
- * Unescapes escaped quotes like `\'`, `\"` back into actual single and double quotes
38
- */
39
- export declare function unescapeQuotes(argument: undefined): undefined;
40
- export declare function unescapeQuotes(argument: string): string;
41
- export declare function unescapeQuotes(argument: string | undefined): string | undefined;
42
- /**
43
- * Unescapes escape sequences like `\r`, `\n`, `\t`, `\'`, `\"`, `\\` back into actual newlines, tabs, quotes, and backslashes
37
+ * The characters the content of an R string literal stands for, see {@link unescapeRString}; as written where R would reject it
44
38
  */
45
39
  export declare function unescapeSpecialChars(argument: undefined): undefined;
46
40
  export declare function unescapeSpecialChars(argument: string): string;
@@ -6,9 +6,9 @@ exports.resolveIdToArgStringVector = resolveIdToArgStringVector;
6
6
  exports.resolveIdToArgValueSymbolName = resolveIdToArgValueSymbolName;
7
7
  exports.resolveIdToArgVectorLength = resolveIdToArgVectorLength;
8
8
  exports.unquoteArgument = unquoteArgument;
9
- exports.unescapeQuotes = unescapeQuotes;
10
9
  exports.unescapeSpecialChars = unescapeSpecialChars;
11
10
  const identifier_1 = require("../../dataflow/environments/identifier");
11
+ const string_constants_1 = require("../../dataflow/eval/values/string/string-constants");
12
12
  const resolve_helper_1 = require("../../dataflow/environments/resolve-helper");
13
13
  const r_argument_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
14
14
  const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
@@ -110,16 +110,7 @@ function unquoteArgument(argument) {
110
110
  }
111
111
  return argument;
112
112
  }
113
- function unescapeQuotes(argument) {
114
- if (argument === undefined) {
115
- return undefined;
116
- }
117
- return argument.replaceAll('\\\'', '\'').replaceAll('\\"', '"');
118
- }
119
113
  function unescapeSpecialChars(argument) {
120
- if (argument === undefined) {
121
- return undefined;
122
- }
123
- return unescapeQuotes(argument).replaceAll('\\r', '\r').replaceAll('\\n', '\n').replaceAll('\\t', '\t').replaceAll('\\\\', '\\');
114
+ return argument === undefined ? undefined : (0, string_constants_1.unescapeRString)(argument) ?? argument;
124
115
  }
125
116
  //# sourceMappingURL=resolve-args.js.map
@@ -3,26 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.controlflowBbStarCommand = exports.controlflowBbCommand = exports.controlflowStarCommand = exports.controlflowCommand = void 0;
4
4
  const cfg_1 = require("../../../util/mermaid/cfg");
5
5
  const cfg_simplification_1 = require("../../../control-flow/cfg-simplification");
6
- const core_1 = require("../core");
7
- const repl_clipboard_1 = require("./repl-clipboard");
8
- async function produceAndPrintCfg(analyzer, output, simplifications, cfgConverter) {
9
- const cfg = await analyzer.controlflow([...cfg_simplification_1.DefaultCfgSimplificationOrder, ...simplifications]);
10
- const normalizedAst = await analyzer.normalize();
11
- const mermaid = cfgConverter(cfg, normalizedAst);
12
- await repl_clipboard_1.ReplClipboard.print(output, mermaid, repl_clipboard_1.ReplClipboard.note(output, 'mermaid code'));
13
- }
6
+ const repl_code_command_1 = require("./repl-code-command");
14
7
  function cfgCommand(description, usageExample, aliases, simplifications, cfgConverter) {
15
- return {
16
- description,
17
- isCodeCommand: true,
18
- usageExample,
19
- aliases,
20
- script: false,
21
- argsParser: (args) => (0, core_1.handleString)(args),
22
- fn: async ({ output, analyzer }) => {
23
- await produceAndPrintCfg(analyzer, output, simplifications, cfgConverter);
24
- }
25
- };
8
+ return (0, repl_code_command_1.clipboardCommand)(description, usageExample, aliases, async (analyzer) => {
9
+ const cfg = await analyzer.controlflow([...cfg_simplification_1.DefaultCfgSimplificationOrder, ...simplifications]);
10
+ return { text: cfgConverter(cfg, await analyzer.normalize()), type: 'mermaid code' };
11
+ });
26
12
  }
27
13
  exports.controlflowCommand = cfgCommand('Get mermaid code for the control-flow graph of R code', ':controlflow', ['cfg', 'cf'], [], cfg_1.cfgToMermaid);
28
14
  exports.controlflowStarCommand = cfgCommand('Returns the URL to mermaid.live', ':controlflow*', ['cfg*', 'cf*'], [], cfg_1.cfgToMermaidUrl);
@@ -0,0 +1,10 @@
1
+ import type { ReplCodeCommand, ReplCodeCommandInformation } from './repl-main';
2
+ /** A code command whose code is everything after the command, as for most analysis commands. */
3
+ export declare function codeCommand(description: string, usageExample: string, aliases: string[], fn: ReplCodeCommand['fn']): ReplCodeCommand;
4
+ /** A code command that prints `text` of the given `type` (and copies it to the clipboard), mentioning the timing of the pipeline `step` if given. */
5
+ export declare function clipboardCommand(description: string, usageExample: string, aliases: string[], produce: (analyzer: ReplCodeCommandInformation['analyzer']) => Promise<{
6
+ readonly text: string;
7
+ readonly type: string;
8
+ readonly step?: string;
9
+ readonly timing?: number;
10
+ }>): ReplCodeCommand;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.codeCommand = codeCommand;
4
+ exports.clipboardCommand = clipboardCommand;
5
+ const core_1 = require("../core");
6
+ const repl_clipboard_1 = require("./repl-clipboard");
7
+ /** A code command whose code is everything after the command, as for most analysis commands. */
8
+ function codeCommand(description, usageExample, aliases, fn) {
9
+ return { description, isCodeCommand: true, usageExample, aliases, script: false, argsParser: (args) => (0, core_1.handleString)(args), fn };
10
+ }
11
+ /** A code command that prints `text` of the given `type` (and copies it to the clipboard), mentioning the timing of the pipeline `step` if given. */
12
+ function clipboardCommand(description, usageExample, aliases, produce) {
13
+ return codeCommand(description, usageExample, aliases, async ({ output, analyzer }) => {
14
+ const { text, type, step, timing } = await produce(analyzer);
15
+ await repl_clipboard_1.ReplClipboard.print(output, text, repl_clipboard_1.ReplClipboard.note(output, type, step, timing));
16
+ });
17
+ }
18
+ //# sourceMappingURL=repl-code-command.js.map
@@ -2,8 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dataflowSimpleStarCommand = exports.dataflowSimplifiedCommand = exports.dataflowSilentCommand = exports.dataflowAsciiCommand = exports.dataflowStarCommand = exports.dataflowCommand = void 0;
4
4
  const ansi_1 = require("../../../util/text/ansi");
5
- const core_1 = require("../core");
6
- const repl_clipboard_1 = require("./repl-clipboard");
5
+ const repl_code_command_1 = require("./repl-code-command");
7
6
  const vertex_1 = require("../../../dataflow/graph/vertex");
8
7
  const dfg_ascii_1 = require("../../../util/simple-df/dfg-ascii");
9
8
  const df_helper_1 = require("../../../dataflow/graph/df-helper");
@@ -88,66 +87,42 @@ function printReferenceSections(output, sections) {
88
87
  }
89
88
  }
90
89
  function mermaidCommand(description, usageExample, aliases, url, simplified) {
91
- return {
92
- description,
93
- isCodeCommand: true,
94
- usageExample,
95
- aliases,
96
- script: false,
97
- argsParser: (args) => (0, core_1.handleString)(args),
98
- fn: async ({ output, analyzer }) => {
99
- const result = await analyzer.dataflow();
100
- const qualifyBaseR = (0, config_1.isSigDbEnabled)(analyzer.flowrConfig);
101
- const mermaid = url ? df_helper_1.Dataflow.visualize.mermaid.url(result.graph, false, undefined, simplified, qualifyBaseR)
102
- : df_helper_1.Dataflow.visualize.mermaid.convert({ graph: result.graph, includeEnvironments: false, simplified: simplified || undefined, qualifyBaseR }).string;
103
- await repl_clipboard_1.ReplClipboard.print(output, mermaid, repl_clipboard_1.ReplClipboard.note(output, url ? 'mermaid url' : 'mermaid code', 'dataflow', result['.meta'].timing));
104
- }
105
- };
90
+ return (0, repl_code_command_1.clipboardCommand)(description, usageExample, aliases, async (analyzer) => {
91
+ const result = await analyzer.dataflow();
92
+ const qualifyBaseR = (0, config_1.isSigDbEnabled)(analyzer.flowrConfig);
93
+ const text = url ? df_helper_1.Dataflow.visualize.mermaid.url(result.graph, false, undefined, simplified, qualifyBaseR)
94
+ : df_helper_1.Dataflow.visualize.mermaid.convert({ graph: result.graph, includeEnvironments: false, simplified: simplified || undefined, qualifyBaseR }).string;
95
+ return { text, type: url ? 'mermaid url' : 'mermaid code', step: 'dataflow', timing: result['.meta'].timing };
96
+ });
106
97
  }
107
98
  exports.dataflowCommand = mermaidCommand('Get mermaid code for the dataflow graph', ':dataflow', ['d', 'df'], false, false);
108
99
  exports.dataflowStarCommand = mermaidCommand('Returns the URL to mermaid.live', ':dataflow*', ['d*', 'df*'], true, false);
109
- exports.dataflowAsciiCommand = {
110
- description: 'Returns an ASCII representation of the dataflow graph',
111
- isCodeCommand: true,
112
- usageExample: ':dataflowascii',
113
- aliases: ['df!'],
114
- script: false,
115
- argsParser: (args) => (0, core_1.handleString)(args),
116
- fn: async ({ output, analyzer }) => {
117
- const result = await analyzer.dataflow();
118
- output.stdout((0, dfg_ascii_1.dfgToAscii)(result.graph));
119
- }
120
- };
121
- exports.dataflowSilentCommand = {
122
- description: 'Just calculates the DFG, but only prints summary info',
123
- isCodeCommand: true,
124
- usageExample: ':dataflowsilent',
125
- aliases: ['d#', 'df#'],
126
- script: false,
127
- argsParser: (args) => (0, core_1.handleString)(args),
128
- fn: async ({ output, analyzer }) => {
129
- const result = await analyzer.dataflow();
130
- const numOfEdges = Array.from(result.graph.edges().flatMap(e => e[1].entries())).length;
131
- const numOfVertices = Array.from(result.graph.vertices(true)).length;
132
- output.stdout(output.formatter.format(`Dataflow calculated in ${result['.meta'].timing}ms.`, { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground, style: 3 /* FontStyles.Italic */ }));
133
- printCounts(output, [
134
- { label: 'Edges', value: numOfEdges },
135
- { label: 'Vertices', value: numOfVertices },
136
- ...Object.entries(vertex_1.VertexType).map(([name, vertType]) => ({
137
- label: name,
138
- value: Array.from(result.graph.verticesOfType(vertType)).length,
139
- indent: true
140
- }))
141
- ]);
142
- const { idMap } = await analyzer.normalize();
143
- printReferenceSections(output, [
144
- { title: 'In', lines: result.in.map(r => referenceRow(r, idMap)) },
145
- { title: 'Out', lines: result.out.map(r => referenceRow(r, idMap)) },
146
- { title: 'Unknown References', lines: result.unknownReferences.map(r => referenceRow(r, idMap)) },
147
- { title: 'Kill', lines: (result.kill ?? []).map(k => killRow(k, idMap)) }
148
- ]);
149
- }
150
- };
100
+ exports.dataflowAsciiCommand = (0, repl_code_command_1.codeCommand)('Returns an ASCII representation of the dataflow graph', ':dataflowascii', ['df!'], async ({ output, analyzer }) => {
101
+ const result = await analyzer.dataflow();
102
+ output.stdout((0, dfg_ascii_1.dfgToAscii)(result.graph));
103
+ });
104
+ exports.dataflowSilentCommand = (0, repl_code_command_1.codeCommand)('Just calculates the DFG, but only prints summary info', ':dataflowsilent', ['d#', 'df#'], async ({ output, analyzer }) => {
105
+ const result = await analyzer.dataflow();
106
+ const numOfEdges = Array.from(result.graph.edges().flatMap(e => e[1].entries())).length;
107
+ const numOfVertices = Array.from(result.graph.vertices(true)).length;
108
+ output.stdout(output.formatter.format(`Dataflow calculated in ${result['.meta'].timing}ms.`, { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground, style: 3 /* FontStyles.Italic */ }));
109
+ printCounts(output, [
110
+ { label: 'Edges', value: numOfEdges },
111
+ { label: 'Vertices', value: numOfVertices },
112
+ ...Object.entries(vertex_1.VertexType).map(([name, vertType]) => ({
113
+ label: name,
114
+ value: Array.from(result.graph.verticesOfType(vertType)).length,
115
+ indent: true
116
+ }))
117
+ ]);
118
+ const { idMap } = await analyzer.normalize();
119
+ printReferenceSections(output, [
120
+ { title: 'In', lines: result.in.map(r => referenceRow(r, idMap)) },
121
+ { title: 'Out', lines: result.out.map(r => referenceRow(r, idMap)) },
122
+ { title: 'Unknown References', lines: result.unknownReferences.map(r => referenceRow(r, idMap)) },
123
+ { title: 'Kill', lines: (result.kill ?? []).map(k => killRow(k, idMap)) }
124
+ ]);
125
+ });
151
126
  exports.dataflowSimplifiedCommand = mermaidCommand('Get mermaid code for the simplified dataflow graph', ':dataflowsimple', ['ds', 'dfs'], false, true);
152
127
  exports.dataflowSimpleStarCommand = mermaidCommand('Returns the URL to mermaid.live', ':dataflowsimple*', ['ds*', 'dfs*'], true, true);
153
128
  //# sourceMappingURL=repl-dataflow.js.map
@@ -3,52 +3,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeHashCommand = exports.normalizeStarCommand = exports.normalizeCommand = void 0;
4
4
  const ast_1 = require("../../../util/mermaid/ast");
5
5
  const ansi_1 = require("../../../util/text/ansi");
6
- const core_1 = require("../core");
7
- const repl_clipboard_1 = require("./repl-clipboard");
6
+ const repl_code_command_1 = require("./repl-code-command");
8
7
  const defaultmap_1 = require("../../../util/collections/defaultmap");
9
8
  const r_project_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
10
9
  function normalizeMermaidCommand(description, usageExample, aliases, convert) {
11
- return {
12
- description,
13
- isCodeCommand: true,
14
- usageExample,
15
- aliases,
16
- script: false,
17
- argsParser: (args) => (0, core_1.handleString)(args),
18
- fn: async ({ output, analyzer }) => {
19
- const result = await analyzer.normalize();
20
- await repl_clipboard_1.ReplClipboard.print(output, convert(result.ast), repl_clipboard_1.ReplClipboard.note(output, 'mermaid url', 'normalize', result['.meta'].timing));
21
- }
22
- };
10
+ return (0, repl_code_command_1.clipboardCommand)(description, usageExample, aliases, async (analyzer) => {
11
+ const result = await analyzer.normalize();
12
+ return { text: convert(result.ast), type: 'mermaid url', step: 'normalize', timing: result['.meta'].timing };
13
+ });
23
14
  }
24
15
  exports.normalizeCommand = normalizeMermaidCommand('Get mermaid code for the normalized AST of R code', ':normalize', ['n'], ast_1.normalizedAstToMermaid);
25
16
  exports.normalizeStarCommand = normalizeMermaidCommand('Returns the URL to mermaid.live', ':normalize*', ['n*'], ast_1.normalizedAstToMermaidUrl);
26
- exports.normalizeHashCommand = {
27
- description: 'Returns summarization stats for the normalized AST',
28
- isCodeCommand: true,
29
- usageExample: ':normalize#',
30
- aliases: ['n#'],
31
- script: false,
32
- argsParser: (args) => (0, core_1.handleString)(args),
33
- fn: async ({ output, analyzer }) => {
34
- const result = await analyzer.normalize();
35
- const counts = new defaultmap_1.DefaultMap(() => 0);
36
- let total = 0;
37
- const files = result.ast.files.length;
38
- r_project_1.RProject.visitAst(result.ast, n => {
39
- counts.set(n.type, counts.get(n.type) + 1);
40
- total++;
41
- });
42
- const num = (s, pad = 0) => output.formatter.format(s.toString().padStart(pad, ' '), { color: 6 /* Colors.Cyan */, effect: ansi_1.ColorEffect.Foreground });
43
- output.stdout(output.formatter.format('Calculated in ' + result['.meta'].timing + 'ms', { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground, style: 3 /* FontStyles.Italic */ }));
44
- output.stdout(`${num(total)} nodes total over ${num(files)} file(s)`);
45
- const longestType = counts.keys().map(p => p.toString().length).reduce((a, b) => Math.max(a, b), 0);
46
- for (const [type, count] of counts.entries().toArray().sort((a, b) => b[1] - a[1])) {
47
- output.stdout(` ${(type + ':').padEnd(longestType + 1, ' ')} ${num(count, 7)}`);
48
- }
49
- if (result.hasError) {
50
- output.stderr(output.formatter.format('There were errors during normalization, enable lax mode to parse (see :parse)!', { color: 1 /* Colors.Red */, effect: ansi_1.ColorEffect.Foreground, style: 1 /* FontStyles.Bold */ }));
51
- }
17
+ exports.normalizeHashCommand = (0, repl_code_command_1.codeCommand)('Returns summarization stats for the normalized AST', ':normalize#', ['n#'], async ({ output, analyzer }) => {
18
+ const result = await analyzer.normalize();
19
+ const counts = new defaultmap_1.DefaultMap(() => 0);
20
+ let total = 0;
21
+ const files = result.ast.files.length;
22
+ r_project_1.RProject.visitAst(result.ast, n => {
23
+ counts.set(n.type, counts.get(n.type) + 1);
24
+ total++;
25
+ });
26
+ const num = (s, pad = 0) => output.formatter.format(s.toString().padStart(pad, ' '), { color: 6 /* Colors.Cyan */, effect: ansi_1.ColorEffect.Foreground });
27
+ output.stdout(output.formatter.format('Calculated in ' + result['.meta'].timing + 'ms', { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground, style: 3 /* FontStyles.Italic */ }));
28
+ output.stdout(`${num(total)} nodes total over ${num(files)} file(s)`);
29
+ const longestType = counts.keys().map(p => p.toString().length).reduce((a, b) => Math.max(a, b), 0);
30
+ for (const [type, count] of counts.entries().toArray().sort((a, b) => b[1] - a[1])) {
31
+ output.stdout(` ${(type + ':').padEnd(longestType + 1, ' ')} ${num(count, 7)}`);
32
+ }
33
+ if (result.hasError) {
34
+ output.stderr(output.formatter.format('There were errors during normalization, enable lax mode to parse (see :parse)!', { color: 1 /* Colors.Red */, effect: ansi_1.ColorEffect.Foreground, style: 1 /* FontStyles.Bold */ }));
52
35
  }
53
- };
36
+ });
54
37
  //# sourceMappingURL=repl-normalize.js.map
@@ -10,6 +10,7 @@ const json_1 = require("../../../util/json");
10
10
  const args_1 = require("../../../util/text/args");
11
11
  const record_1 = require("../../../util/record");
12
12
  const retriever_1 = require("../../../r-bridge/retriever");
13
+ const string_constants_1 = require("../../../dataflow/eval/values/string/string-constants");
13
14
  const path_input_1 = require("../path-input");
14
15
  /**
15
16
  * Whether the analyzer already holds exactly `input` as its sole request, so a prior analysis (e.g. a
@@ -180,20 +181,16 @@ function parseQueryArgs(line) {
180
181
  };
181
182
  }
182
183
  /**
183
- * Undoes a wrapping of the whole code in quotes, as `:query \@dependencies "library(x)"` writes it. A quote the
184
- * code itself contains ends the wrapping early, so it is left alone.
184
+ * Undoes a wrapping of the whole code in quotes, as `:query \@dependencies "library(x)"` writes it. Double quotes
185
+ * undo their escapes as R does, so `\n` separates statements; an escape R rejects, e.g. in a Windows path, is kept as written.
185
186
  */
186
187
  function unwrapQuotedInput(code) {
187
188
  const quote = code[0];
188
- if ((quote !== '"' && quote !== '\'') || code.length < 2 || code[code.length - 1] !== quote) {
189
+ if ((quote !== '"' && quote !== '\'') || (0, args_1.closingQuote)(code) !== code.length - 1) {
189
190
  return code;
190
191
  }
191
- for (let i = 1; i < code.length - 1; i++) {
192
- if (code[i] === quote && code[i - 1] !== '\\') {
193
- return code;
194
- }
195
- }
196
- return code.slice(1, -1);
192
+ const inner = code.slice(1, -1);
193
+ return quote === '"' ? (0, string_constants_1.unescapeRString)(inner) ?? inner : inner;
197
194
  }
198
195
  /**
199
196
  * Separates the query from everything after it. The query is either a bare token (`@static-slice`) or the
@@ -201,16 +198,12 @@ function unwrapQuotedInput(code) {
201
198
  */
202
199
  function splitQueryFromRest(line) {
203
200
  const trimmed = line.trimStart();
204
- const quote = trimmed[0];
205
- if (quote !== '"' && quote !== '\'') {
201
+ if (trimmed[0] !== '"' && trimmed[0] !== '\'') {
206
202
  const space = trimmed.indexOf(' ');
207
203
  return space < 0 ? [trimmed, ''] : [trimmed.slice(0, space), trimmed.slice(space + 1)];
208
204
  }
209
- let end = 1;
210
- while (end < trimmed.length && !(trimmed[end] === quote && trimmed[end - 1] !== '\\')) {
211
- end++;
212
- }
213
- return [trimmed.slice(1, end).replace(/\\(.)/g, '$1'), trimmed.slice(end + 1).trimStart()];
205
+ const end = (0, args_1.closingQuote)(trimmed) ?? trimmed.length;
206
+ return [(0, args_1.unescapeArg)(trimmed.slice(1, end)), trimmed.slice(end + 1).trimStart()];
214
207
  }
215
208
  exports.queryCommand = {
216
209
  description: 'Query the given R code (use \'help\' for more information)',
@@ -224,7 +217,7 @@ exports.queryCommand = {
224
217
  const results = await processQueryArgs(output, analyzer, remainingArgs);
225
218
  const totalEnd = Date.now();
226
219
  if (results) {
227
- output.stdout(await (0, query_print_1.asciiSummaryOfQueryResult)(ansi_1.ansiFormatter, totalEnd - totalStart, results.query, results.analyzer, results.parsedQuery));
220
+ output.stdout(await (0, query_print_1.asciiSummaryOfQueryResult)(output.formatter, totalEnd - totalStart, results.query, results.analyzer, results.parsedQuery));
228
221
  }
229
222
  }
230
223
  };
package/config.js CHANGED
@@ -306,13 +306,13 @@ exports.FlowrConfig = {
306
306
  assumeImplicitEcho: true
307
307
  },
308
308
  linter: {
309
- disabledRules: [],
310
- /* the R CMD check rules only make sense for a package, which re-enables them below */
309
+ /* tests and the R CMD check rules only make sense for a package, which re-enables them below */
310
+ disabledRules: ['software-has-tests'],
311
311
  disabledTags: ['cmd-check']
312
312
  },
313
313
  specializeConfig: {
314
314
  /* a package's top-level code runs at install time, its results are not echoed to anyone */
315
- [project_kind_1.ProjectKind.Package]: { project: { assumeImplicitEcho: false }, solver: { resolveSource: { assumeFilesExist: true } }, linter: { disabledTags: [] } },
315
+ [project_kind_1.ProjectKind.Package]: { project: { assumeImplicitEcho: false }, solver: { resolveSource: { assumeFilesExist: true } }, linter: { disabledRules: [], disabledTags: [] } },
316
316
  [project_kind_1.ProjectKind.Project]: { solver: { resolveSource: { assumeFilesExist: true } } },
317
317
  [project_kind_1.ProjectKind.ShinyApp]: {
318
318
  /* shiny evaluates global.R before the supporting files in R/, and the app itself last */
@@ -10,6 +10,7 @@ const graph_1 = require("../dataflow/graph/graph");
10
10
  const node_value_1 = require("../dataflow/eval/resolve/node-value");
11
11
  const built_in_proc_name_1 = require("../dataflow/environments/built-in-proc-name");
12
12
  const log_1 = require("../util/log");
13
+ const function_semantics_1 = require("../dataflow/fn/function-semantics");
13
14
  const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
14
15
  const r_value_1 = require("../dataflow/eval/values/r-value");
15
16
  const convert_values_1 = require("../r-bridge/lang-4.x/convert-values");
@@ -22,6 +23,7 @@ class CfgConditionalDeadCodeRemoval extends semantic_cfg_guided_visitor_1.Semant
22
23
  cachedStatements = new Map();
23
24
  cachedSwitch = new Map();
24
25
  caught = new Map();
26
+ forcing;
25
27
  getValue(id) {
26
28
  const has = this.cachedConditions.get(id);
27
29
  if (has) {
@@ -119,10 +121,12 @@ class CfgConditionalDeadCodeRemoval extends semantic_cfg_guided_visitor_1.Semant
119
121
  this.handleWithCondition(data);
120
122
  }
121
123
  onStopCall(data) {
122
- this.cachedStatements.set(data.call.id, true);
124
+ if (!this.mayStayUnforced(data.call.id)) {
125
+ this.cachedStatements.set(data.call.id, true);
126
+ }
123
127
  }
124
128
  onStopIfNotCall(data) {
125
- if (this.cachedStatements.has(data.call.id)) {
129
+ if (this.cachedStatements.has(data.call.id) || this.mayStayUnforced(data.call.id)) {
126
130
  return;
127
131
  }
128
132
  const arg = this.getBoolArgValue(data);
@@ -130,6 +134,15 @@ class CfgConditionalDeadCodeRemoval extends semantic_cfg_guided_visitor_1.Semant
130
134
  this.cachedStatements.set(data.call.id, !arg);
131
135
  }
132
136
  }
137
+ /** whether the call is in an argument that may never be evaluated: `stop("x")` in `f(1, stop("x"))` only runs if `f` uses it */
138
+ mayStayUnforced(id) {
139
+ const promised = this.config.dfg.getVertex(id)?.cds?.filter(cd => cd.byPromise === true) ?? [];
140
+ if (promised.length === 0) {
141
+ return false;
142
+ }
143
+ this.forcing ??= function_semantics_1.FunctionSemantics.promiseForcing(this.config.dfg, { ctx: this.config.ctx });
144
+ return promised.some(cd => this.forcing?.(cd.id, id) !== logic_1.Ternary.Always);
145
+ }
133
146
  /**
134
147
  * Whether an error raised here is caught before it can cut the flow, which is what `try` and `tryCatch`
135
148
  * do to a `stop()` nested in them. The enclosing calls come from the AST: in the control flow graph a
@@ -55,8 +55,7 @@ function holdsOneElement(value, element = false) {
55
55
  return false;
56
56
  }
57
57
  return value.type === 'vector' ? (0, r_value_1.isValue)(value.elements) && value.elements.length === 1 && holdsOneElement(value.elements[0], true)
58
- : value.type === 'interval' ? (0, r_value_1.isValue)(value.start) && (0, r_value_1.isValue)(value.end) && value.startInclusive && value.endInclusive
59
- && (0, r_value_1.isValue)(value.start.value) && (0, r_value_1.isValue)(value.end.value) && value.start.value.num === value.end.value.num
58
+ : value.type === 'interval' ? r_value_1.RValue.numberOf(value) !== undefined
60
59
  : (value.type === 'string' || value.type === 'logical' || (element && value.type === 'number')) && (0, r_value_1.isValue)(value.value);
61
60
  }
62
61
  class CfgSingleIterationLoopDetector extends semantic_cfg_guided_visitor_1.SemanticCfgGuidedVisitor {