@eagleoutice/flowr 2.10.10 → 2.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/README.md +35 -27
  2. package/cli/common/options.d.ts +2 -108
  3. package/cli/common/options.js +3 -27
  4. package/cli/common/scripts-info.d.ts +2 -123
  5. package/cli/common/scripts-info.js +0 -17
  6. package/cli/flowr-main-options.d.ts +5 -0
  7. package/cli/flowr-main-options.js +10 -0
  8. package/cli/flowr.js +2 -2
  9. package/cli/repl/commands/repl-commands.js +7 -6
  10. package/cli/repl/print-version.d.ts +3 -1
  11. package/cli/repl/print-version.js +21 -2
  12. package/cli/repl/server/connection.d.ts +2 -0
  13. package/cli/repl/server/connection.js +40 -31
  14. package/cli/script-core/summarizer-core.js +13 -32
  15. package/cli/wiki.d.ts +2 -1
  16. package/cli/wiki.js +2 -0
  17. package/config.d.ts +9 -0
  18. package/config.js +10 -0
  19. package/control-flow/semantic-cfg-guided-visitor.js +1 -0
  20. package/core/steps/pipeline/default-pipelines.d.ts +146 -146
  21. package/data/pkgdb/pkgdb-latest.json.br +0 -0
  22. package/data/pkgdb/pkgdb-tiny.json.br +0 -0
  23. package/dataflow/environments/append.d.ts +1 -2
  24. package/dataflow/environments/append.js +3 -10
  25. package/dataflow/environments/apply-kill.d.ts +21 -0
  26. package/dataflow/environments/apply-kill.js +155 -0
  27. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  28. package/dataflow/environments/built-in-proc-name.js +2 -0
  29. package/dataflow/environments/built-in.d.ts +2 -0
  30. package/dataflow/environments/built-in.js +2 -0
  31. package/dataflow/environments/default-builtin-config.d.ts +63 -3
  32. package/dataflow/environments/default-builtin-config.js +40 -8
  33. package/dataflow/environments/environment.d.ts +49 -32
  34. package/dataflow/environments/environment.js +133 -18
  35. package/dataflow/environments/identifier.d.ts +10 -0
  36. package/dataflow/environments/identifier.js +23 -0
  37. package/dataflow/environments/overwrite.js +2 -10
  38. package/dataflow/environments/resolve-by-name.d.ts +1 -1
  39. package/dataflow/environments/resolve-by-name.js +10 -2
  40. package/dataflow/environments/scoping.d.ts +9 -2
  41. package/dataflow/environments/scoping.js +15 -2
  42. package/dataflow/extractor.js +23 -2
  43. package/dataflow/graph/df-helper.d.ts +8 -0
  44. package/dataflow/graph/df-helper.js +8 -0
  45. package/dataflow/graph/graph.d.ts +4 -1
  46. package/dataflow/graph/graph.js +5 -1
  47. package/dataflow/info.d.ts +26 -0
  48. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +7 -5
  49. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +19 -0
  50. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +1 -8
  51. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +7 -13
  52. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +9 -48
  53. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +30 -47
  54. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +17 -0
  55. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +6 -1
  56. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +2 -2
  57. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +8 -1
  58. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +9 -0
  59. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +37 -3
  60. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +391 -21
  61. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +2 -1
  62. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +131 -48
  63. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +25 -0
  64. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +94 -0
  65. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +10 -3
  66. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +30 -0
  67. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +279 -0
  68. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
  69. package/dataflow/internal/process/functions/call/named-call-handling.js +17 -0
  70. package/documentation/data/faq/faqs.js +3 -0
  71. package/documentation/data/interface/doc-writing-code.js +4 -80
  72. package/documentation/doc-util/doc-structure.js +1 -2
  73. package/documentation/wiki-core.js +2 -1
  74. package/documentation/wiki-dataflow-graph.js +35 -1
  75. package/documentation/wiki-interface.js +2 -2
  76. package/documentation/wiki-linter.js +2 -0
  77. package/documentation/wiki-overview.js +1 -14
  78. package/documentation/wiki-package-database.d.ts +9 -0
  79. package/documentation/wiki-package-database.js +63 -0
  80. package/documentation/wiki-query.js +1 -0
  81. package/linter/linter-rules.d.ts +23 -0
  82. package/linter/linter-rules.js +3 -1
  83. package/linter/rules/absolute-path.js +2 -1
  84. package/linter/rules/undefined-symbol.d.ts +39 -0
  85. package/linter/rules/undefined-symbol.js +80 -0
  86. package/package.json +4 -4
  87. package/project/cache/flowr-analyzer-cache.d.ts +2 -0
  88. package/project/cache/flowr-analyzer-cache.js +9 -1
  89. package/project/context/flowr-analyzer-dependencies-context.d.ts +16 -8
  90. package/project/context/flowr-analyzer-dependencies-context.js +39 -4
  91. package/project/context/flowr-analyzer-environment-context.d.ts +2 -4
  92. package/project/context/flowr-analyzer-environment-context.js +3 -4
  93. package/project/context/flowr-analyzer-files-context.d.ts +1 -0
  94. package/project/context/flowr-file.d.ts +2 -0
  95. package/project/context/flowr-file.js +2 -0
  96. package/project/flowr-analyzer-builder.js +3 -0
  97. package/project/flowr-analyzer.d.ts +2 -1
  98. package/project/flowr-analyzer.js +3 -1
  99. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +13 -15
  100. package/project/plugins/file-plugins/files/flowr-namespace-file.js +36 -13
  101. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +27 -0
  102. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +41 -0
  103. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +18 -0
  104. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +62 -0
  105. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.d.ts +63 -0
  106. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-pkgdb-plugin.js +176 -0
  107. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.d.ts +10 -0
  108. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-plugin.js +6 -0
  109. package/project/plugins/package-version-plugins/package.d.ts +3 -0
  110. package/project/plugins/package-version-plugins/package.js +12 -0
  111. package/project/plugins/package-version-plugins/pkgdb.d.ts +133 -0
  112. package/project/plugins/package-version-plugins/pkgdb.js +370 -0
  113. package/project/plugins/plugin-registry.d.ts +4 -1
  114. package/project/plugins/plugin-registry.js +7 -0
  115. package/queries/catalog/call-context-query/call-context-query-executor.js +8 -0
  116. package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -0
  117. package/queries/catalog/call-context-query/call-context-query-format.js +1 -0
  118. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +8 -0
  119. package/queries/catalog/dependencies-query/dependencies-query-executor.js +31 -3
  120. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +3 -1
  121. package/queries/catalog/dependencies-query/dependencies-query-format.js +3 -2
  122. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +1 -1
  123. package/queries/catalog/dependencies-query/function-info/other-path-functions.d.ts +2 -0
  124. package/queries/catalog/dependencies-query/function-info/other-path-functions.js +27 -0
  125. package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -4
  126. package/queries/catalog/dependencies-query/function-info/visualize-functions.js +3 -1
  127. package/queries/catalog/linter-query/linter-query-executor.js +1 -0
  128. package/r-bridge/data/data.d.ts +2 -2
  129. package/r-bridge/data/data.js +2 -2
  130. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +13 -4
  131. package/search/search-executor/search-enrichers.d.ts +1 -1
  132. package/search/search-executor/search-enrichers.js +7 -4
  133. package/util/mermaid/mermaid.d.ts +4 -0
  134. package/util/mermaid/mermaid.js +8 -1
  135. package/util/text/ansi.d.ts +10 -1
  136. package/util/text/ansi.js +17 -4
  137. package/util/version.js +10 -2
  138. package/cli/common/features.d.ts +0 -9
  139. package/cli/common/features.js +0 -35
  140. package/cli/script-core/statistics-core.d.ts +0 -6
  141. package/cli/script-core/statistics-core.js +0 -104
  142. package/cli/script-core/statistics-helper-core.d.ts +0 -6
  143. package/cli/script-core/statistics-helper-core.js +0 -86
  144. package/cli/statistics-app.d.ts +0 -11
  145. package/cli/statistics-app.js +0 -16
  146. package/cli/statistics-helper-app.d.ts +0 -11
  147. package/cli/statistics-helper-app.js +0 -14
  148. package/statistics/features/common-syntax-probability.d.ts +0 -38
  149. package/statistics/features/common-syntax-probability.js +0 -169
  150. package/statistics/features/feature.d.ts +0 -179
  151. package/statistics/features/feature.js +0 -38
  152. package/statistics/features/post-processing.d.ts +0 -18
  153. package/statistics/features/post-processing.js +0 -26
  154. package/statistics/features/supported/assignments/assignments.d.ts +0 -12
  155. package/statistics/features/supported/assignments/assignments.js +0 -56
  156. package/statistics/features/supported/assignments/post-process.d.ts +0 -6
  157. package/statistics/features/supported/assignments/post-process.js +0 -126
  158. package/statistics/features/supported/comments/comments.d.ts +0 -18
  159. package/statistics/features/supported/comments/comments.js +0 -143
  160. package/statistics/features/supported/comments/post-process.d.ts +0 -6
  161. package/statistics/features/supported/comments/post-process.js +0 -51
  162. package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
  163. package/statistics/features/supported/control-flow/control-flow.js +0 -69
  164. package/statistics/features/supported/control-flow/post-process.d.ts +0 -6
  165. package/statistics/features/supported/control-flow/post-process.js +0 -66
  166. package/statistics/features/supported/data-access/data-access.d.ts +0 -15
  167. package/statistics/features/supported/data-access/data-access.js +0 -122
  168. package/statistics/features/supported/data-access/post-process.d.ts +0 -6
  169. package/statistics/features/supported/data-access/post-process.js +0 -108
  170. package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -34
  171. package/statistics/features/supported/defined-functions/defined-functions.js +0 -145
  172. package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
  173. package/statistics/features/supported/defined-functions/post-process.js +0 -168
  174. package/statistics/features/supported/expression-list/post-process.d.ts +0 -6
  175. package/statistics/features/supported/expression-list/post-process.js +0 -45
  176. package/statistics/features/supported/expression-list/statistics-expression-list.d.ts +0 -9
  177. package/statistics/features/supported/expression-list/statistics-expression-list.js +0 -37
  178. package/statistics/features/supported/loops/loops.d.ts +0 -20
  179. package/statistics/features/supported/loops/loops.js +0 -81
  180. package/statistics/features/supported/loops/post-process.d.ts +0 -6
  181. package/statistics/features/supported/loops/post-process.js +0 -73
  182. package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
  183. package/statistics/features/supported/used-functions/post-process.js +0 -176
  184. package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
  185. package/statistics/features/supported/used-functions/used-functions.js +0 -99
  186. package/statistics/features/supported/used-packages/post-process.d.ts +0 -6
  187. package/statistics/features/supported/used-packages/post-process.js +0 -122
  188. package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
  189. package/statistics/features/supported/used-packages/used-packages.js +0 -140
  190. package/statistics/features/supported/values/post-process.d.ts +0 -6
  191. package/statistics/features/supported/values/post-process.js +0 -73
  192. package/statistics/features/supported/values/values.d.ts +0 -14
  193. package/statistics/features/supported/values/values.js +0 -111
  194. package/statistics/features/supported/variables/post-process.d.ts +0 -15
  195. package/statistics/features/supported/variables/post-process.js +0 -126
  196. package/statistics/features/supported/variables/variables.d.ts +0 -15
  197. package/statistics/features/supported/variables/variables.js +0 -62
  198. package/statistics/meta-statistics.d.ts +0 -32
  199. package/statistics/meta-statistics.js +0 -16
  200. package/statistics/output/file-provider.d.ts +0 -36
  201. package/statistics/output/file-provider.js +0 -96
  202. package/statistics/output/print-stats.d.ts +0 -29
  203. package/statistics/output/print-stats.js +0 -81
  204. package/statistics/output/statistics-file.d.ts +0 -36
  205. package/statistics/output/statistics-file.js +0 -68
  206. package/statistics/statistics.d.ts +0 -29
  207. package/statistics/statistics.js +0 -108
  208. package/statistics/summarizer/auto-detect.d.ts +0 -5
  209. package/statistics/summarizer/auto-detect.js +0 -34
  210. package/statistics/summarizer/first-phase/process.d.ts +0 -6
  211. package/statistics/summarizer/first-phase/process.js +0 -81
  212. package/statistics/summarizer/post-process/clusterer.d.ts +0 -25
  213. package/statistics/summarizer/post-process/clusterer.js +0 -40
  214. package/statistics/summarizer/post-process/file-based-count.d.ts +0 -16
  215. package/statistics/summarizer/post-process/file-based-count.js +0 -47
  216. package/statistics/summarizer/post-process/histogram.d.ts +0 -57
  217. package/statistics/summarizer/post-process/histogram.js +0 -126
  218. package/statistics/summarizer/post-process/post-process-output.d.ts +0 -14
  219. package/statistics/summarizer/post-process/post-process-output.js +0 -102
  220. package/statistics/summarizer/second-phase/process.d.ts +0 -15
  221. package/statistics/summarizer/second-phase/process.js +0 -118
  222. package/statistics/summarizer/summarizer.d.ts +0 -34
  223. package/statistics/summarizer/summarizer.js +0 -141
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ReadFunctions = void 0;
4
4
  exports.ReadFunctions = [
5
5
  { package: 'base', name: 'parse', argName: 'file', resolveValue: true, ignoreIf: 'arg-missing' },
6
- { package: 'base', name: 'read.table', argIdx: 0, argName: 'file', resolveValue: true },
7
- { package: 'utils', name: 'read.csv', argIdx: 0, argName: 'file', resolveValue: true },
8
- { package: 'utils', name: 'read.csv2', argIdx: 0, argName: 'file', resolveValue: true },
9
- { package: 'utils', name: 'read.delim', argIdx: 0, argName: 'file', resolveValue: true },
6
+ { package: 'base', name: 'read.table', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
7
+ { package: 'utils', name: 'read.csv', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
8
+ { package: 'utils', name: 'read.csv2', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
9
+ { package: 'utils', name: 'read.delim', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
10
+ { package: 'utils', name: 'read.delim2', argIdx: 0, argName: 'file', resolveValue: true, ignoreIf: 'arg-set', additionalArgs: { argSet: { argName: 'text' } } },
10
11
  { package: 'base', name: 'read.dcf', argIdx: 0, argName: 'file', resolveValue: true },
11
12
  { package: 'base', name: 'scan', argIdx: 0, argName: 'file', resolveValue: true },
12
13
  { package: 'utils', name: 'read.fwf', argIdx: 0, argName: 'file', resolveValue: true },
@@ -7,7 +7,9 @@ const LinkToPlotCreation = [
7
7
  ];
8
8
  exports.VisualizeFunctions =
9
9
  // plot creation
10
- default_builtin_config_1.GgPlotCreate.map(f => ({ package: 'ggplot2', name: f })).concat(default_builtin_config_1.TinyPlotCrate.map(f => ({ package: 'tinyplot', name: f })), default_builtin_config_1.GraphicsPlotCreate.map(f => ({ name: f })),
10
+ default_builtin_config_1.GgPlotCreate.map(f => ({ package: 'ggplot2', name: f })).concat(default_builtin_config_1.TinyPlotCrate.map(f => ({ package: 'tinyplot', name: f })),
11
+ // `map` is the maps-package plot; qualify it so it does not swallow purrr::map/dplyr::map etc.
12
+ default_builtin_config_1.GraphicsPlotCreate.map(f => f === 'map' ? { name: f, package: 'maps' } : { name: f }),
11
13
  // plot modification
12
14
  default_builtin_config_1.GgPlotImplicitAddons.concat(default_builtin_config_1.GgPlotAddons).map(f => ({ package: 'ggplot2', name: f, linkTo: LinkToPlotCreation })), default_builtin_config_1.TinyPlotAddons.map(f => ({ package: 'tinyplot', name: f, linkTo: LinkToPlotCreation })), default_builtin_config_1.GraphicsPlotAddons.map(f => ({ name: f, linkTo: LinkToPlotCreation }))).map(f => {
13
15
  if (f.name !== 'hist') {
@@ -16,6 +16,7 @@ async function executeLinterQuery({ analyzer }, queries) {
16
16
  const pretty = [...distinct].filter(r => flattened.indexOf(r) !== flattened.lastIndexOf(r)).map(r => typeof r === 'string' ? r : r.name).join(', ');
17
17
  log_1.log.warn(`Linter query collection contains duplicate rules ${pretty}, only linting for each rule once`);
18
18
  }
19
+ // typed loosely to avoid a too-complex mapped-union at the indexed writes below; cast back on return
19
20
  const results = { results: {} };
20
21
  const start = Date.now();
21
22
  const gas = analyzer.inspectContext().gas;
@@ -118,7 +118,7 @@ export declare const flowrCapabilities: {
118
118
  readonly name: "Search Path";
119
119
  readonly id: "search-path";
120
120
  readonly supported: "partially";
121
- readonly description: "_Handling [R's search path](https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Search-path) as explained in [Advanced R](https://adv-r.hadley.nz/environments.html#search-path)._ Currently, _flowR_ does not support dynamic modifications with `attach`, `search`, or `fn_env` and tests are definitely missing. Yet, theoretically, the tooling is all there.";
121
+ readonly description: "_Handling [R's search path](https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Search-path) as explained in [Advanced R](https://adv-r.hadley.nz/environments.html#search-path)._ Attached packages and `attach`ed environments are placed below `.GlobalEnv` (so global bindings shadow package exports, matching R), attaching inside/through function calls propagates to the caller, and re-attaching is a no-op. Not yet handled: dynamic `search`/`fn_env` manipulation.";
122
122
  }, {
123
123
  readonly name: "Namespaces";
124
124
  readonly id: "namespaces";
@@ -137,7 +137,7 @@ export declare const flowrCapabilities: {
137
137
  }, {
138
138
  readonly name: "Library Loading";
139
139
  readonly id: "library-loading";
140
- readonly supported: "not";
140
+ readonly supported: "partially";
141
141
  readonly description: "_Resolve libraries identified with `library`, `require`, `attachNamespace`, ... and attach them to the search path_";
142
142
  }, {
143
143
  readonly name: "Dynamic Scope Changes";
@@ -161,7 +161,7 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true })}
161
161
  name: 'Search Path',
162
162
  id: 'search-path',
163
163
  supported: 'partially',
164
- description: "_Handling [R's search path](https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Search-path) as explained in [Advanced R](https://adv-r.hadley.nz/environments.html#search-path)._ Currently, _flowR_ does not support dynamic modifications with `attach`, `search`, or `fn_env` and tests are definitely missing. Yet, theoretically, the tooling is all there."
164
+ description: "_Handling [R's search path](https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Search-path) as explained in [Advanced R](https://adv-r.hadley.nz/environments.html#search-path)._ Attached packages and `attach`ed environments are placed below `.GlobalEnv` (so global bindings shadow package exports, matching R), attaching inside/through function calls propagates to the caller, and re-attaching is a no-op. Not yet handled: dynamic `search`/`fn_env` manipulation."
165
165
  },
166
166
  {
167
167
  name: 'Namespaces',
@@ -184,7 +184,7 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true })}
184
184
  {
185
185
  name: 'Library Loading',
186
186
  id: 'library-loading',
187
- supported: 'not',
187
+ supported: 'partially',
188
188
  description: '_Resolve libraries identified with `library`, `require`, `attachNamespace`, ... and attach them to the search path_'
189
189
  },
190
190
  {
@@ -74,10 +74,19 @@ class TreeSitterExecutor {
74
74
  return this.parser.getLanguage().query(source);
75
75
  }
76
76
  query(source, ...tree) {
77
- const query = typeof source === 'string' ? this.createQuery(source) : source;
78
- return tree
79
- .flatMap(t => query.matches(t.rootNode))
80
- .flatMap(m => m.captures);
77
+ // a Query is WASM-backed, so free it if we created it (a caller-supplied Query stays theirs)
78
+ const ownQuery = typeof source === 'string';
79
+ const query = ownQuery ? this.createQuery(source) : source;
80
+ try {
81
+ return tree
82
+ .flatMap(t => query.matches(t.rootNode))
83
+ .flatMap(m => m.captures);
84
+ }
85
+ finally {
86
+ if (ownQuery) {
87
+ query.delete();
88
+ }
89
+ }
81
90
  }
82
91
  close() {
83
92
  this.parser.delete();
@@ -2,7 +2,7 @@ import type { FlowrSearchElement, FlowrSearchElements } from '../flowr-search';
2
2
  import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
3
3
  import { type MergeableRecord } from '../../util/objects';
4
4
  import type { LinkToLastCall } from '../../queries/catalog/call-context-query/call-context-query-format';
5
- import { type NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
5
+ import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
6
6
  import type { ControlFlowInformation } from '../../control-flow/control-flow-graph';
7
7
  import type { Query, QueryResult } from '../../queries/query';
8
8
  import { type CfgSimplificationPassName } from '../../control-flow/cfg-simplification';
@@ -48,9 +48,11 @@ exports.Enrichments = {
48
48
  content.targets = content.targets.concat(origins.map(o => {
49
49
  switch (o.type) {
50
50
  case 2 /* OriginType.FunctionCallOrigin */:
51
- return {
52
- node: n.idMap.get(o.id),
53
- };
51
+ // a built-in target (e.g. a materialized package export from `library()`) has no
52
+ // user-code node, so surface it as a built-in string target (see `onlyBuiltin` below)
53
+ return node_id_1.NodeId.isBuiltIn(o.id)
54
+ ? (0, node_id_1.recoverName)(o.id, n.idMap) ?? String(o.id)
55
+ : { node: n.idMap.get(o.id) };
54
56
  case 3 /* OriginType.BuiltInFunctionOrigin */:
55
57
  return identifier_1.Identifier.toString(o.fn.name);
56
58
  default:
@@ -62,7 +64,8 @@ exports.Enrichments = {
62
64
  }
63
65
  }
64
66
  }
65
- // if there is a call target that is not built-in (ie a custom function), we don't want to include it here
67
+ // keep only calls whose targets are all built-in; library/package exports arrive as string
68
+ // targets and count as built-in, a target with a `node` is user code and disqualifies the call
66
69
  if (args?.onlyBuiltin && content.targets.some(t => typeof t !== 'string')) {
67
70
  content.targets = [];
68
71
  }
@@ -46,6 +46,10 @@ export declare const Mermaid: {
46
46
  * Escapes markdown special characters in a string.
47
47
  */
48
48
  readonly escape: (this: void, text: string) => string;
49
+ /**
50
+ * Reserved mermaid flowchart keywords that break parsing when used as a bare node id token.
51
+ */
52
+ readonly reservedIds: Set<string>;
49
53
  /**
50
54
  * Escapes a string or number to be used as a mermaid node id.
51
55
  */
@@ -55,12 +55,19 @@ exports.Mermaid = {
55
55
  }
56
56
  return text;
57
57
  },
58
+ /**
59
+ * Reserved mermaid flowchart keywords that break parsing when used as a bare node id token.
60
+ */
61
+ reservedIds: new Set([
62
+ 'graph', 'flowchart', 'subgraph', 'end', 'style', 'default', 'linkStyle',
63
+ 'interpolate', 'classDef', 'class', 'href', 'click', 'call', 'direction'
64
+ ]),
58
65
  /**
59
66
  * Escapes a string or number to be used as a mermaid node id.
60
67
  */
61
68
  escapeId(text) {
62
69
  text = String(text).replace(/[^a-zA-Z0-9:-]/g, '_');
63
- return text;
70
+ return text.replace(/(^|[:-])([a-zA-Z0-9_]+)/g, (_m, sep, tok) => sep + (exports.Mermaid.reservedIds.has(tok) ? tok + '_' : tok));
64
71
  },
65
72
  /**
66
73
  * Converts mermaid code (potentially produced by {@link DataflowMermaid.convert}) to an url that presents the graph in the mermaid editor.
@@ -22,9 +22,11 @@ export type FormatOptions = ColorFormatOptions | WeightFormatOptions | ColorForm
22
22
  export interface ColorFormatOptions {
23
23
  color: Colors;
24
24
  effect: ColorEffect;
25
+ /** use the high-intensity variant */
26
+ bright?: boolean;
25
27
  }
26
28
  export interface WeightFormatOptions {
27
- style: FontStyles;
29
+ style: FontStyles | readonly FontStyles[];
28
30
  }
29
31
  export interface OutputFormatter {
30
32
  format(input: string, options?: FormatOptions): string;
@@ -41,6 +43,13 @@ export declare function italic(s: string, f?: OutputFormatter, options?: FormatO
41
43
  * This does not work if the {@link setFormatter|formatter} is void. Tries to format the text with an italic font shape.
42
44
  */
43
45
  export declare function bold(s: string, f?: OutputFormatter, options?: FormatOptions): string;
46
+ /**
47
+ * Color the text in the given foreground color.
48
+ */
49
+ export declare function color(s: string, c: Colors, f?: OutputFormatter, opts?: {
50
+ bright?: boolean;
51
+ style?: FontStyles | readonly FontStyles[];
52
+ }): string;
44
53
  /**
45
54
  * This does not work if the {@link setFormatter|formatter} is void. Tries to format the text as informational message.
46
55
  */
package/util/text/ansi.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.formatter = exports.ansiFormatter = exports.escape = exports.markdownFormatter = exports.voidFormatter = exports.ColorEffect = void 0;
4
4
  exports.italic = italic;
5
5
  exports.bold = bold;
6
+ exports.color = color;
6
7
  exports.ansiInfo = ansiInfo;
7
8
  exports.setFormatter = setFormatter;
8
9
  // noinspection JSUnusedGlobalSymbols
@@ -32,7 +33,7 @@ exports.markdownFormatter = new class {
32
33
  input = `_${input}_`;
33
34
  }
34
35
  else {
35
- throw new Error(`Unsupported font style: ${options.style}`);
36
+ throw new Error(`Unsupported font style: ${String(options.style)}`);
36
37
  }
37
38
  }
38
39
  let source = input.replaceAll(/\\"/g, '\'').replaceAll(/\\/g, '\\\\').replaceAll(/\n/g, '\\\n');
@@ -64,6 +65,12 @@ function italic(s, f = exports.formatter, options) {
64
65
  function bold(s, f = exports.formatter, options) {
65
66
  return f.format(s, { style: 1 /* FontStyles.Bold */, ...options });
66
67
  }
68
+ /**
69
+ * Color the text in the given foreground color.
70
+ */
71
+ function color(s, c, f = exports.formatter, opts) {
72
+ return f.format(s, { color: c, effect: ColorEffect.Foreground, ...opts });
73
+ }
67
74
  /**
68
75
  * This does not work if the {@link setFormatter|formatter} is void. Tries to format the text as informational message.
69
76
  */
@@ -83,9 +90,15 @@ exports.ansiFormatter = {
83
90
  if (options === undefined) {
84
91
  return '';
85
92
  }
86
- const colorString = 'color' in options ? `${options.effect + options.color}` : '';
87
- const weightString = 'style' in options ? `${options.style}` : '';
88
- return `${exports.escape}${colorString}${weightString !== '' ? ';' : ''}${weightString}${colorSuffix}`;
93
+ const params = [];
94
+ if ('style' in options) {
95
+ const styles = Array.isArray(options.style) ? options.style : [options.style];
96
+ params.push(...styles);
97
+ }
98
+ if ('color' in options) {
99
+ params.push((options.bright ? options.effect + 60 : options.effect) + options.color);
100
+ }
101
+ return params.length === 0 ? '' : `${exports.escape}${params.join(';')}${colorSuffix}`;
89
102
  }
90
103
  };
91
104
  exports.formatter = exports.ansiFormatter;
package/util/version.js CHANGED
@@ -6,7 +6,7 @@ exports.printVersionInformation = printVersionInformation;
6
6
  const semver_1 = require("semver");
7
7
  const assert_1 = require("./assert");
8
8
  // this is automatically replaced with the current version by release-it
9
- const version = '2.10.10';
9
+ const version = '2.11.1';
10
10
  /**
11
11
  * Retrieves the current flowR version as a new {@link SemVer} object.
12
12
  */
@@ -39,8 +39,16 @@ async function retrieveVersionInformation(input) {
39
39
  */
40
40
  async function printVersionInformation(output, input) {
41
41
  const { flowr, r, engine } = await retrieveVersionInformation(input);
42
+ const faint = (s) => output.formatter.format(s, { style: 2 /* FontStyles.Faint */ });
42
43
  output.stdout(`Engine: ${engine}`);
43
44
  output.stdout(` flowR: ${flowr}`);
44
- output.stdout(` R: ${r}`);
45
+ // gray out R when it is not actually available
46
+ output.stdout((r === 'none' || r === 'unknown') ? faint(` R: ${r}`) : ` R: ${r}`);
47
+ if (typeof input !== 'function' && 'inspectContext' in input) {
48
+ // reads the current analyzer, so it reflects the databases in use (and adapts to config changes)
49
+ const dbs = input.inspectContext().deps.loadedPackageDatabases();
50
+ const line = ` package databases: ${dbs.length === 0 ? 'none' : dbs.map(d => `${d.scope} (v${d.version}, ${d.date})`).join(', ')}`;
51
+ output.stdout(dbs.length === 0 ? faint(line) : line);
52
+ }
45
53
  }
46
54
  //# sourceMappingURL=version.js.map
@@ -1,9 +0,0 @@
1
- import { type FeatureKey } from '../../statistics/features/feature';
2
- /**
3
- * Validate that the given features are known by flowR.
4
- */
5
- export declare function validateFeatures(features: (string[] | ['all'] | FeatureKey[])): Set<FeatureKey>;
6
- /**
7
- * Retrieve the archive name for the given path.
8
- */
9
- export declare function retrieveArchiveName(p: string): string;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.validateFeatures = validateFeatures;
7
- exports.retrieveArchiveName = retrieveArchiveName;
8
- const path_1 = __importDefault(require("path"));
9
- const feature_1 = require("../../statistics/features/feature");
10
- /**
11
- * Validate that the given features are known by flowR.
12
- */
13
- function validateFeatures(features) {
14
- for (const feature of features) {
15
- if (feature === 'all') {
16
- if (features.length > 1) {
17
- console.error(`Feature "all" must be the only feature given, got ${features.join(', ')}`);
18
- process.exit(1);
19
- }
20
- }
21
- else if (!feature_1.allFeatureNames.has(feature)) {
22
- console.error(`Feature ${feature} is unknown, supported are ${[...feature_1.allFeatureNames].join(', ')} or "all"`);
23
- process.exit(1);
24
- }
25
- }
26
- return features[0] === 'all' ? feature_1.allFeatureNames : new Set(features);
27
- }
28
- /**
29
- * Retrieve the archive name for the given path.
30
- */
31
- function retrieveArchiveName(p) {
32
- const basepath = path_1.default.normalize(p);
33
- return `${basepath.endsWith(path_1.default.sep) ? basepath.substring(0, basepath.length - 1) : basepath}.tar.gz`;
34
- }
35
- //# sourceMappingURL=features.js.map
@@ -1,6 +0,0 @@
1
- import type { StatsCliOptions } from '../statistics-app';
2
- import type { FlowrConfig } from '../../config';
3
- /**
4
- * The core function for the 'flowr stats' script.
5
- */
6
- export declare function flowrScriptGetStats(options: StatsCliOptions, config: FlowrConfig): Promise<void>;
@@ -1,104 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.flowrScriptGetStats = flowrScriptGetStats;
7
- const path_1 = __importDefault(require("path"));
8
- const parallel_1 = require("../../util/parallel");
9
- const files_1 = require("../../util/files");
10
- const features_1 = require("../common/features");
11
- const fs_1 = __importDefault(require("fs"));
12
- const statistics_file_1 = require("../../statistics/output/statistics-file");
13
- const json_1 = require("../../util/json");
14
- const log_1 = require("../../util/log");
15
- const statistics_helper_core_1 = require("./statistics-helper-core");
16
- const command_line_args_1 = __importDefault(require("command-line-args"));
17
- const scripts_info_1 = require("../common/scripts-info");
18
- const ansi_1 = require("../../util/text/ansi");
19
- const proc_1 = require("../../util/proc");
20
- const testRegex = /[^/]*\/test/i;
21
- const exampleRegex = /[^/]*\/example/i;
22
- function getPrefixForFile(file) {
23
- if (testRegex.test(file)) {
24
- return 'test-';
25
- }
26
- else if (exampleRegex.test(file)) {
27
- return 'example-';
28
- }
29
- else {
30
- return '';
31
- }
32
- }
33
- function getSuffixForFile(base, file) {
34
- const subpath = path_1.default.relative(base, file);
35
- return '--' + subpath.replace(/\//g, '/');
36
- }
37
- async function collectFileArguments(options, verboseAdd, dumpJson, features) {
38
- const files = [];
39
- let counter = 0;
40
- let presentSteps = 5000;
41
- let skipped = 0;
42
- for await (const f of (0, files_1.allRFilesFrom)(options.input)) {
43
- const outputDir = path_1.default.join(options['output-dir'], `${getPrefixForFile(f.content)}${getSuffixForFile(options.input.length === 1 ? options.input[0] : '', f.content)}`);
44
- const target = (0, features_1.retrieveArchiveName)(outputDir);
45
- if (fs_1.default.existsSync(target)) {
46
- console.log(`Archive ${target} exists. Skip.`);
47
- skipped++;
48
- continue;
49
- }
50
- files.push(['--input', f.content, '--output-dir', outputDir, '--compress', '--root-dir', options.input.length === 1 ? options.input[0] : '""', ...verboseAdd, ...features, ...dumpJson]);
51
- if (++counter % presentSteps === 0) {
52
- console.log(`Collected ${counter} files`);
53
- if (counter >= 10 * presentSteps) {
54
- presentSteps *= 5;
55
- }
56
- }
57
- }
58
- console.log(`Total: ${counter} files (${skipped} skipped with archive existing)`);
59
- return files;
60
- }
61
- /**
62
- * The core function for the 'flowr stats' script.
63
- */
64
- async function flowrScriptGetStats(options, config) {
65
- if (options.input.length === 0) {
66
- console.error('No input files given. Nothing to do. See \'--help\' if this is an error.');
67
- return (0, proc_1.exitSafe)(0);
68
- }
69
- if (options['no-ansi']) {
70
- log_1.log.info('disabling ansi colors');
71
- (0, ansi_1.setFormatter)(ansi_1.voidFormatter);
72
- }
73
- const processedFeatures = (0, features_1.validateFeatures)(options.features);
74
- (0, statistics_file_1.initFileProvider)(options['output-dir']);
75
- console.log(`Processing features: ${JSON.stringify(processedFeatures, json_1.jsonReplacer)}`);
76
- console.log(`Using ${options.parallel} parallel executors`);
77
- const verboseAdd = options.verbose ? ['--verbose'] : [];
78
- const features = [...processedFeatures].flatMap(s => ['--features', s]);
79
- const dumpJson = options['dump-json'] ? ['--dump-json'] : [];
80
- // we do not use the limit argument to be able to pick the limit randomly
81
- const args = await collectFileArguments(options, verboseAdd, dumpJson, features);
82
- if (options.limit) {
83
- console.log('Shuffle...');
84
- log_1.log.info(`limiting to ${options.limit} files`);
85
- // shuffle and limit
86
- args.sort(() => Math.random() - 0.5);
87
- }
88
- console.log('Prepare Pool...');
89
- const limit = options.limit ?? args.length;
90
- if (options.parallel > 0) {
91
- const pool = new parallel_1.LimitedThreadPool(`${__dirname}/statistics-helper-app`, args, limit, options.parallel);
92
- console.log('Run Pool...');
93
- await pool.run();
94
- const stats = pool.getStats();
95
- console.log(`Processed ${stats.counter} files, skipped ${stats.skipped.length} files due to errors`);
96
- }
97
- else {
98
- console.log('Run Sequentially as parallel <= 0...');
99
- for (const arg of args) {
100
- await (0, statistics_helper_core_1.getStatsForSingleFile)((0, command_line_args_1.default)(scripts_info_1.scripts['stats-helper'].options, { argv: arg }), config);
101
- }
102
- }
103
- }
104
- //# sourceMappingURL=statistics-core.js.map
@@ -1,6 +0,0 @@
1
- import type { StatsHelperCliOptions } from '../statistics-helper-app';
2
- import { FlowrConfig } from '../../config';
3
- /**
4
- * Get statistics for a single file
5
- */
6
- export declare function getStatsForSingleFile(options: StatsHelperCliOptions, config: FlowrConfig): Promise<void>;
@@ -1,86 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getStatsForSingleFile = getStatsForSingleFile;
7
- const features_1 = require("../common/features");
8
- const fs_1 = __importDefault(require("fs"));
9
- const shell_1 = require("../../r-bridge/shell");
10
- const statistics_file_1 = require("../../statistics/output/statistics-file");
11
- const statistics_1 = require("../../statistics/statistics");
12
- const extract_cfg_1 = require("../../control-flow/extract-cfg");
13
- const print_1 = require("../../core/print/print");
14
- const _00_parse_1 = require("../../core/steps/all/core/00-parse");
15
- const _10_normalize_1 = require("../../core/steps/all/core/10-normalize");
16
- const _20_dataflow_1 = require("../../core/steps/all/core/20-dataflow");
17
- const json_1 = require("../../util/json");
18
- const log_1 = require("../../util/log");
19
- const assert_1 = require("../../util/assert");
20
- const time_1 = require("../../util/text/time");
21
- const tar_1 = require("tar");
22
- const ansi_1 = require("../../util/text/ansi");
23
- const config_1 = require("../../config");
24
- const proc_1 = require("../../util/proc");
25
- const flowr_analyzer_context_1 = require("../../project/context/flowr-analyzer-context");
26
- function compressFolder(folder, target) {
27
- return (0, tar_1.create)({
28
- gzip: true,
29
- file: target,
30
- portable: true,
31
- preservePaths: false
32
- }, [folder]).then(() => {
33
- // now, remove the folder
34
- fs_1.default.rmSync(folder, { recursive: true, force: true });
35
- }, () => {
36
- console.log(`failed to compress ${folder}`);
37
- }).catch((e) => {
38
- console.error('Error during compression:', e);
39
- });
40
- }
41
- /**
42
- * Get statistics for a single file
43
- */
44
- async function getStatsForSingleFile(options, config) {
45
- if (options['no-ansi']) {
46
- log_1.log.info('disabling ansi colors');
47
- (0, ansi_1.setFormatter)(ansi_1.voidFormatter);
48
- }
49
- let target = undefined;
50
- if (options.compress) {
51
- target = (0, features_1.retrieveArchiveName)(options['output-dir']);
52
- if (fs_1.default.existsSync(target)) {
53
- console.log(`Archive ${target} exists. Skip.`);
54
- return (0, proc_1.exitSafe)(0);
55
- }
56
- }
57
- // assume correct
58
- const processedFeatures = new Set(options.features);
59
- const shell = new shell_1.RShell(config_1.FlowrConfig.getForEngine(config, 'r-shell'));
60
- (0, statistics_file_1.initFileProvider)(options['output-dir']);
61
- await shell.obtainTmpDir();
62
- const stats = await (0, statistics_1.extractUsageStatistics)(shell, config, () => { }, processedFeatures, (0, statistics_1.staticRequests)({ request: 'file', content: options.input }), options['root-dir']);
63
- // console.warn(`skipped ${stats.meta.failedRequests.length} requests due to errors (run with logs to get more info)`)
64
- if (stats.outputs.size === 1) {
65
- if (options['dump-json']) {
66
- const [, output] = [...stats.outputs.entries()][0];
67
- const cfg = (0, extract_cfg_1.extractCfg)(output.normalize, (0, flowr_analyzer_context_1.contextFromInput)('', config), output.dataflow.graph);
68
- statistics_file_1.statisticsFileProvider.append('output-json', 'parse', await (0, print_1.printStepResult)(_00_parse_1.PARSE_WITH_R_SHELL_STEP, output.parse, 2 /* StepOutputFormat.Json */));
69
- statistics_file_1.statisticsFileProvider.append('output-json', 'normalize', await (0, print_1.printStepResult)(_10_normalize_1.NORMALIZE, output.normalize, 2 /* StepOutputFormat.Json */));
70
- statistics_file_1.statisticsFileProvider.append('output-json', 'dataflow', await (0, print_1.printStepResult)(_20_dataflow_1.STATIC_DATAFLOW, output.dataflow, 2 /* StepOutputFormat.Json */));
71
- statistics_file_1.statisticsFileProvider.append('output-json', 'cfg', JSON.stringify(cfg, json_1.jsonReplacer));
72
- }
73
- statistics_file_1.statisticsFileProvider.append('meta', 'stats', JSON.stringify({ ...stats.meta, file: options.input }, json_1.jsonReplacer));
74
- statistics_file_1.statisticsFileProvider.append('meta', 'features', JSON.stringify(stats.features, json_1.jsonReplacer));
75
- }
76
- else {
77
- log_1.log.error(`expected exactly one output vs. ${stats.outputs.size}, got: ${JSON.stringify([...stats.outputs.keys()], json_1.jsonReplacer, 2)}`);
78
- }
79
- if (options.compress) {
80
- (0, assert_1.guard)(target !== undefined, 'target must be defined given the compress option');
81
- console.log(`[${(0, time_1.date2string)(new Date())}] Compressing ${options['output-dir']} to ${target}`);
82
- await compressFolder(options['output-dir'], target);
83
- }
84
- shell.close();
85
- }
86
- //# sourceMappingURL=statistics-helper-core.js.map
@@ -1,11 +0,0 @@
1
- export interface StatsCliOptions {
2
- readonly verbose: boolean;
3
- readonly help: boolean;
4
- readonly limit: number | undefined;
5
- readonly input: string[];
6
- readonly 'dump-json': boolean;
7
- readonly 'output-dir': string;
8
- readonly 'no-ansi': boolean;
9
- readonly parallel: number;
10
- readonly features: string[];
11
- }
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const script_1 = require("./common/script");
4
- const statistics_core_1 = require("./script-core/statistics-core");
5
- const config_1 = require("../config");
6
- const scriptOptions = (0, script_1.processCommandLineArgs)('stats', [], {
7
- subtitle: 'Given input files or folders, this will collect usage statistics for the given features and write them to a file',
8
- examples: [
9
- '{bold -i} {italic example.R} {bold -i} {italic example2.R} {bold --output-dir} {italic "output-folder/"}',
10
- '{italic "folder1/"} {bold --features} {italic all} {bold --output-dir} {italic "output-folder/"}',
11
- '{bold --post-process} {italic "output-folder"} {bold --features} {italic assignments}',
12
- '{bold --help}'
13
- ]
14
- });
15
- void (0, statistics_core_1.flowrScriptGetStats)(scriptOptions, config_1.FlowrConfig.fromFile());
16
- //# sourceMappingURL=statistics-app.js.map
@@ -1,11 +0,0 @@
1
- export interface StatsHelperCliOptions {
2
- readonly verbose: boolean;
3
- readonly help: boolean;
4
- readonly input: string;
5
- readonly compress: boolean;
6
- readonly 'dump-json': boolean;
7
- readonly 'output-dir': string;
8
- readonly 'root-dir': string;
9
- readonly 'no-ansi': boolean;
10
- readonly features: string[];
11
- }
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const script_1 = require("./common/script");
4
- const statistics_helper_core_1 = require("./script-core/statistics-helper-core");
5
- const config_1 = require("../config");
6
- const scriptOptions = (0, script_1.processCommandLineArgs)('stats-helper', [], {
7
- subtitle: 'Given a single input file, this will collect usage statistics for the given features and write them to a file',
8
- examples: [
9
- '{bold -i} {italic example.R} {bold -i} {italic example2.R} {bold --output-dir} {italic "output-folder/"}',
10
- '{bold --help}'
11
- ]
12
- });
13
- void (0, statistics_helper_core_1.getStatsForSingleFile)(scriptOptions, config_1.FlowrConfig.fromFile());
14
- //# sourceMappingURL=statistics-helper-app.js.map
@@ -1,38 +0,0 @@
1
- import { type SummarizedMeasurement } from '../../util/summarizer';
2
- import { RFalse, RTrue } from '../../r-bridge/lang-4.x/convert-values';
3
- import type { RArgument } from '../../r-bridge/lang-4.x/ast/model/nodes/r-argument';
4
- import type { RNode } from '../../r-bridge/lang-4.x/ast/model/model';
5
- export interface CommonSyntaxTypeCounts<Measurement = bigint> {
6
- total: Measurement;
7
- multiple: Measurement;
8
- empty: Measurement;
9
- withArgument: Measurement;
10
- noValue: Measurement;
11
- singleVar: Record<string, Measurement>;
12
- number: Record<number, Measurement>;
13
- integer: Record<number, Measurement>;
14
- complex: Record<number, Measurement>;
15
- string: Record<string, Measurement>;
16
- logical: Record<typeof RTrue | typeof RFalse, Measurement>;
17
- call: Record<string, Measurement>;
18
- unnamedCall: Measurement;
19
- binOp: Record<string, Measurement>;
20
- unaryOp: Record<string, Measurement>;
21
- other: Record<string, Measurement>;
22
- }
23
- /**
24
- *
25
- */
26
- export declare function emptyCommonSyntaxTypeCounts<T = bigint>(init?: () => T): CommonSyntaxTypeCounts<T>;
27
- /**
28
- * Updates the given counts based on the type of the given node.
29
- */
30
- export declare function updateCommonSyntaxTypeCounts(current: CommonSyntaxTypeCounts, ...nodes: (RNode | RArgument)[]): CommonSyntaxTypeCounts;
31
- /**
32
- *
33
- */
34
- export declare function appendCommonSyntaxTypeCounter(a: CommonSyntaxTypeCounts<number[][]>, b: CommonSyntaxTypeCounts): void;
35
- /**
36
- *
37
- */
38
- export declare function summarizeCommonSyntaxTypeCounter(a: CommonSyntaxTypeCounts<number[][]>): CommonSyntaxTypeCounts<SummarizedMeasurement>;