@eagleoutice/flowr 2.16.6 → 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 (315) 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/static-slicer.js +6 -0
  295. package/util/assert.js +2 -2
  296. package/util/collections/arrays.d.ts +4 -0
  297. package/util/collections/arrays.js +11 -0
  298. package/util/collections/defaultmap.d.ts +5 -1
  299. package/util/collections/defaultmap.js +6 -1
  300. package/util/files.js +26 -5
  301. package/util/flowr-version.d.ts +10 -0
  302. package/util/flowr-version.js +20 -0
  303. package/util/glob.js +6 -4
  304. package/util/r-regex.d.ts +6 -0
  305. package/util/r-regex.js +17 -0
  306. package/util/text/args.d.ts +5 -0
  307. package/util/text/args.js +28 -22
  308. package/util/text/name-rank.d.ts +2 -0
  309. package/util/text/name-rank.js +3 -1
  310. package/util/text/regex.d.ts +10 -0
  311. package/util/text/regex.js +29 -0
  312. package/util/version.d.ts +1 -6
  313. package/util/version.js +6 -14
  314. package/documentation/doc-util/doc-functions.d.ts +0 -24
  315. package/documentation/doc-util/doc-functions.js +0 -65
@@ -0,0 +1,41 @@
1
+ import type { DataflowProcessorInformation } from '../../../../../processor';
2
+ import type { ParentInformation, RNodeWithParent } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
3
+ import { type PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
4
+ import { type KeyedState } from '../../../../../environments/ambient-state-name';
5
+ /**
6
+ * Where a call names the entries of a {@link KeyedState} it sets, declared in the built-in configuration.
7
+ * An entry we cannot name is the {@link UnknownKey}.
8
+ */
9
+ export type AmbientKeys = {
10
+ /**
11
+ * The names of the named arguments, like `Sys.setenv(A = "1")` sets `A`. An unnamed argument stands for entries
12
+ * we cannot name (`par(op)`) unless it is a string, which only queries (`par("mar")`).
13
+ */
14
+ readonly from: 'argument-names';
15
+ /** arguments to leave out, like `par(no.readonly = TRUE)` */
16
+ readonly ignore?: readonly string[];
17
+ } | {
18
+ /** the call always sets this entry, like `Sys.setLanguage` sets `LANGUAGE` */
19
+ readonly from: 'constant';
20
+ readonly key: string;
21
+ } | {
22
+ /** the entries a parameter names, like `Sys.setlocale(category = "LC_ALL")` or `detach(package:dplyr)` */
23
+ readonly from: 'parameter';
24
+ /** the formals of the function, for matching the arguments */
25
+ readonly signature: readonly string[];
26
+ /** the parameters to take the entries from, the first one given wins (`attach(what, name = "x")` is `x`) */
27
+ readonly names: readonly string[];
28
+ /** the entry set if none of the parameters is given */
29
+ readonly fallback?: string;
30
+ /**
31
+ * The parameter is quoted, so a symbol or string is the name itself (`library(dplyr)`) instead of a variable to look up.
32
+ * A parameter name states the flag that switches to looking up its value (`library(pkg, character.only = TRUE)`).
33
+ */
34
+ readonly quoted?: boolean | string;
35
+ };
36
+ /** The strings the value at `value` may have, `undefined` if we do not know. */
37
+ export declare function stringValuesOf<OtherInfo>(value: RNodeWithParent<OtherInfo> | undefined, data: DataflowProcessorInformation<OtherInfo & ParentInformation>): string[] | undefined;
38
+ /** The entries the call with the arguments `args` names, see {@link AmbientKeys}. */
39
+ export declare function keysOf<OtherInfo>(keys: AmbientKeys, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], data: DataflowProcessorInformation<OtherInfo & ParentInformation>): string[];
40
+ /** The pseudo variables a write to the given entries of `state` defines: the entries and what every write to the state adds to. No entry has an empty name. */
41
+ export declare function keyedWrites(state: KeyedState, given: readonly string[]): string[];
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stringValuesOf = stringValuesOf;
4
+ exports.keysOf = keysOf;
5
+ exports.keyedWrites = keyedWrites;
6
+ const r_function_call_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
7
+ const r_string_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-string");
8
+ const r_symbol_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
9
+ const r_binary_op_1 = require("../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-binary-op");
10
+ const identifier_1 = require("../../../../../environments/identifier");
11
+ const match_args_1 = require("../../../../../graph/match-args");
12
+ const node_value_1 = require("../../../../../eval/resolve/node-value");
13
+ const ambient_state_name_1 = require("../../../../../environments/ambient-state-name");
14
+ /** The strings the value at `value` may have, `undefined` if we do not know. */
15
+ function stringValuesOf(value, data) {
16
+ if (value === undefined) {
17
+ return undefined;
18
+ }
19
+ else if (r_string_1.RString.is(value)) {
20
+ return [value.content.str];
21
+ }
22
+ const strings = node_value_1.NodeValue.stringsOf(value.info.id, data);
23
+ return strings === undefined || strings.length === 0 ? undefined : strings;
24
+ }
25
+ /** What a quoted argument names: `dplyr`, `"dplyr"`, and `package:dplyr`. */
26
+ function quotedName(node) {
27
+ if (r_symbol_1.RSymbol.is(node)) {
28
+ return identifier_1.Identifier.getName(node.content);
29
+ }
30
+ else if (r_string_1.RString.is(node)) {
31
+ return node.content.str;
32
+ }
33
+ else if (r_binary_op_1.RBinaryOp.is(node) && node.operator === ':') {
34
+ const [namespace, name] = [quotedName(node.lhs), quotedName(node.rhs)];
35
+ return namespace === undefined || name === undefined ? undefined : `${namespace}:${name}`;
36
+ }
37
+ return undefined;
38
+ }
39
+ /** Whether the value at `node` is `TRUE`: `'yes'`, `'no'` (also if there is no flag), or `'maybe'`. */
40
+ function flagValue(node, data) {
41
+ const values = node === undefined ? [] : node_value_1.NodeValue.setOf(node.info.id, data)?.elements;
42
+ if (node === undefined) {
43
+ return 'no';
44
+ }
45
+ else if (values === undefined || values.length === 0 || values.some(v => v.type !== 'logical' || typeof v.value !== 'boolean')) {
46
+ return 'maybe';
47
+ }
48
+ const isTrue = values.map(v => v.type === 'logical' && v.value === true);
49
+ return isTrue.every(Boolean) ? 'yes' : isTrue.some(Boolean) ? 'maybe' : 'no';
50
+ }
51
+ function parameterKeys(keys, args, data) {
52
+ const bound = match_args_1.MatchArgs.toNames(args, keys.signature);
53
+ const value = keys.names.map(n => bound.get(n)?.value).find(v => v !== undefined);
54
+ if (value === undefined) {
55
+ return keys.fallback === undefined ? [] : [keys.fallback];
56
+ }
57
+ /* whether the argument is looked up as a value, which the flag switches on for a quoted one */
58
+ const looksUp = typeof keys.quoted === 'string' ? flagValue(bound.get(keys.quoted)?.value, data) : keys.quoted ? 'no' : 'yes';
59
+ const name = looksUp === 'yes' ? undefined : quotedName(value);
60
+ const values = looksUp === 'no' && name !== undefined ? [] : stringValuesOf(value, data) ?? [ambient_state_name_1.UnknownKey];
61
+ return name === undefined ? values : [name, ...values];
62
+ }
63
+ /** The entries the call with the arguments `args` names, see {@link AmbientKeys}. */
64
+ function keysOf(keys, args, data) {
65
+ switch (keys.from) {
66
+ case 'constant':
67
+ return [keys.key];
68
+ case 'argument-names':
69
+ return args.flatMap(a => {
70
+ if (a === r_function_call_1.EmptyArgument) {
71
+ return [];
72
+ }
73
+ else if (a.name !== undefined) {
74
+ const name = identifier_1.Identifier.getName(a.name.content);
75
+ return keys.ignore?.includes(name) ? [] : [name];
76
+ }
77
+ return r_string_1.RString.is(a.value) ? [] : [ambient_state_name_1.UnknownKey];
78
+ });
79
+ case 'parameter':
80
+ return parameterKeys(keys, args, data);
81
+ }
82
+ }
83
+ /** The pseudo variables a write to the given entries of `state` defines: the entries and what every write to the state adds to. No entry has an empty name. */
84
+ function keyedWrites(state, given) {
85
+ const keys = given.filter(k => k !== '');
86
+ return keys.length === 0 ? [] : [...new Set([...keys.map(k => ambient_state_name_1.AmbientStateName.keyed(state, k)), ambient_state_name_1.AmbientStateName.allOf(state)])];
87
+ }
88
+ //# sourceMappingURL=built-in-ambient-keys.js.map
@@ -10,49 +10,8 @@ import { RNode } from '../../../../../../r-bridge/lang-4.x/ast/model/model';
10
10
  import type { LinkTo } from '../../../../../../queries/catalog/call-context-query/call-context-query-format';
11
11
  import type { DataflowGraph } from '../../../../../graph/graph';
12
12
  import { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
13
- /**
14
- * Graphics parameters and options, tracked as global pseudo variables (`#...`) so readers link to the calls that set them.
15
- * Accumulating states only grow: `par(mar = ...)` keeps an earlier `par(mfrow = ...)`.
16
- */
17
- export declare const AmbientStateName: {
18
- /** the graphics state (`par`, `layout`, ...) of the active device, which a new device starts afresh */
19
- readonly graphics: "#graphics";
20
- /** the graphics states of the other open devices, the active one returns to one of them once it closes */
21
- readonly otherDevices: "#graphics:other";
22
- /** the call that opened the active device, and those of the other open devices */
23
- readonly device: "#device";
24
- readonly otherDevicesOpenedBy: "#device:other";
25
- /** the color palette, which, other than the graphics parameters, all devices share */
26
- readonly palette: "#palette";
27
- /** the files on disk, which every call writing a file adds to and every call reading a file we cannot name reads */
28
- readonly files: "#files";
29
- /** written by a call writing a file we cannot name, which every call reading a file reads */
30
- readonly anyFile: "#file:*";
31
- /** the working directory `setwd` changes, which every call accessing a file reads to resolve a relative path */
32
- readonly workingDirectory: "#wd";
33
- /** the state of the random number generator, which `set.seed` sets and every draw advances */
34
- readonly rng: "#rng";
35
- /** the kind of generator, which `set.seed` keeps unless it is given one */
36
- readonly rngKind: "#rng:kind";
37
- /** the global variable R keeps that state in, so assigning it sets {@link AmbientStateName.rng} as well */
38
- readonly rngVariable: ".Random.seed";
39
- /** every option write, for readers that may read any option (`getOption(k)` with an unknown `k`, library functions) */
40
- readonly allOptions: "#options";
41
- /** written by an `options(...)` call whose keys we cannot name, like the common `options(op)` restore */
42
- readonly unknownOption: "#option:*";
43
- /** written along with the option `warn` when it may turn warnings into errors (`warn >= 2`), see {@link errorsOfWarnings} */
44
- readonly warnsAsErrors: "#warn-error";
45
- /** the finalizers registered (`reg.finalizer`) and the removals that may release their objects, which `gc()` may run */
46
- readonly finalizers: "#finalizers";
47
- /** marks `name` as bound to a text connection opened for writing, whose writes change it */
48
- readonly textConnection: (this: void, name: string) => string;
49
- /** the file named `stem` (`data` for `out/data.csv`), so a read of a named file only sees writes that may hit it */
50
- readonly file: (this: void, stem: string) => string;
51
- /** the pseudo variable holding the option `key`; setting the option replaces it */
52
- readonly option: (this: void, key: string) => string;
53
- /** whether `name` is one of these pseudo variables */
54
- readonly is: (this: void, name: Identifier | undefined) => name is string;
55
- };
13
+ import { KeyedState } from '../../../../../environments/ambient-state-name';
14
+ import { type AmbientKeys } from './built-in-ambient-keys';
56
15
  /** Whether calling `definition` runs a body flowR cannot see: a library function's, or whatever a parameter is bound to. */
57
16
  export declare function hidesBody(definition: IdentifierDefinition): boolean;
58
17
  /** A call into code flowR cannot see may read any option, draw random numbers (with `draws` advancing the generator), and with `graphics` draw on the device. */
@@ -112,7 +71,11 @@ export declare const enum AmbientStateAccessType {
112
71
  /** `reg.finalizer(e, f)`: registers `f` to run once `e` is released */
113
72
  RegisterFinalizer = "register-finalizer",
114
73
  /** `gc()`: may run every registered finalizer whose object is released */
115
- RunFinalizers = "run-finalizers"
74
+ RunFinalizers = "run-finalizers",
75
+ /** sets entries of a keyed state, like `Sys.setenv(A = "1")` sets the environment variable `A`, see {@link AmbientKeys} */
76
+ SetKeyed = "set-keyed",
77
+ /** sets a state without entries, like `sink(file)` diverts the output */
78
+ SetState = "set-state"
116
79
  }
117
80
  /** An {@link AmbientStateAccessType} together with what refines it for some of the types. */
118
81
  export type AmbientStateAccess = {
@@ -138,10 +101,22 @@ export type AmbientStateAccess = {
138
101
  readonly type: AmbientStateAccessType.CloseDevice;
139
102
  /** `graphics.off()` closes every device */
140
103
  readonly all?: boolean;
104
+ } | {
105
+ readonly type: AmbientStateAccessType.SetKeyed;
106
+ readonly state: KeyedState;
107
+ readonly keys: AmbientKeys;
108
+ } | {
109
+ readonly type: AmbientStateAccessType.SetState;
110
+ /** the pseudo variable the call sets, like {@link AmbientStateName.sink} */
111
+ readonly state: string;
112
+ /** `Sys.umask()` only queries the state */
113
+ readonly queryWithoutArguments?: boolean;
141
114
  } | {
142
115
  readonly type: AmbientStateAccessType.SetGraphics;
143
116
  /** `par()` and `par("mar")` only query the state */
144
117
  readonly queryOnUnnamedStrings?: boolean;
118
+ /** the parameters the call sets, which each have a pseudo variable of their own, see {@link KeyedState.Par} */
119
+ readonly keys?: AmbientKeys;
145
120
  /** a query also reads what the last plot left behind (`par("usr")`), linked like an unknown side effect */
146
121
  readonly queryLinksTo?: LinkTo<RegExp | string>;
147
122
  };