@eagleoutice/flowr 1.4.1 → 1.5.0

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 (300) hide show
  1. package/README.md +3 -3
  2. package/abstract-interpretation/processor.js +9 -3
  3. package/config.d.ts +16 -0
  4. package/config.js +75 -0
  5. package/core/input.d.ts +1 -1
  6. package/core/output.d.ts +1 -2
  7. package/core/print/parse-printer.d.ts +1 -2
  8. package/core/print/parse-printer.js +6 -4
  9. package/core/print/slice-diff-ansi.js +7 -7
  10. package/core/slicer.js +4 -8
  11. package/core/steps.d.ts +355 -31
  12. package/core/steps.js +7 -14
  13. package/dataflow/environments/environment.js +8 -0
  14. package/dataflow/environments/register.js +1 -0
  15. package/dataflow/extractor.d.ts +2 -2
  16. package/dataflow/extractor.js +10 -2
  17. package/dataflow/internal/process/functions/function-call.js +7 -1
  18. package/dataflow/internal/process/functions/source.d.ts +8 -0
  19. package/dataflow/internal/process/functions/source.js +81 -0
  20. package/dataflow/processor.d.ts +10 -1
  21. package/index.d.ts +0 -2
  22. package/index.js +0 -2
  23. package/package.json +75 -202
  24. package/r-bridge/lang-4.x/ast/index.d.ts +1 -0
  25. package/r-bridge/lang-4.x/ast/index.js +3 -0
  26. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +2 -0
  27. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +6 -1
  28. package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +14 -0
  29. package/r-bridge/lang-4.x/ast/parser/json/format.js +26 -0
  30. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +7 -0
  31. package/r-bridge/lang-4.x/ast/parser/json/parser.js +57 -0
  32. package/r-bridge/lang-4.x/ast/parser/xml/data.d.ts +0 -3
  33. package/r-bridge/lang-4.x/ast/parser/xml/index.d.ts +0 -2
  34. package/r-bridge/lang-4.x/ast/parser/xml/index.js +0 -2
  35. package/r-bridge/lang-4.x/ast/parser/xml/input-format.d.ts +5 -1
  36. package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +7 -10
  37. package/r-bridge/lang-4.x/ast/parser/xml/internal/access.js +2 -2
  38. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then-else.js +1 -1
  39. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then.js +2 -2
  40. package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.js +4 -4
  41. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/argument.js +2 -2
  42. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/call.js +4 -4
  43. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/definition.js +2 -2
  44. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/parameter.js +2 -2
  45. package/r-bridge/lang-4.x/ast/parser/xml/internal/index.d.ts +0 -1
  46. package/r-bridge/lang-4.x/ast/parser/xml/internal/index.js +0 -1
  47. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/break.js +2 -2
  48. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/for.js +3 -6
  49. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/next.js +2 -2
  50. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/repeat.js +2 -2
  51. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/while.js +2 -2
  52. package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.d.ts +6 -11
  53. package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.js +15 -23
  54. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/binary.js +6 -6
  55. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.js +3 -3
  56. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/comment.js +2 -2
  57. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/line-directive.js +2 -2
  58. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.js +3 -3
  59. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.js +3 -4
  60. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.js +2 -2
  61. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/number.js +2 -2
  62. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/string.js +2 -2
  63. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/symbol.js +4 -4
  64. package/r-bridge/lang-4.x/values.d.ts +0 -1
  65. package/r-bridge/lang-4.x/values.js +14 -6
  66. package/r-bridge/retriever.d.ts +25 -21
  67. package/r-bridge/retriever.js +73 -23
  68. package/r-bridge/shell-executor.d.ts +3 -17
  69. package/r-bridge/shell-executor.js +9 -78
  70. package/r-bridge/shell.d.ts +5 -27
  71. package/r-bridge/shell.js +31 -92
  72. package/{statistics/output → util}/ansi.js +1 -1
  73. package/util/args.d.ts +8 -4
  74. package/util/args.js +11 -4
  75. package/util/cfg/visitor.js +1 -1
  76. package/util/files.d.ts +6 -0
  77. package/util/files.js +11 -1
  78. package/util/log.js +3 -0
  79. package/util/{summarizer/summarizer.d.ts → summarizer.d.ts} +15 -1
  80. package/util/summarizer.js +37 -0
  81. package/util/version.d.ts +2 -0
  82. package/util/version.js +10 -0
  83. package/benchmark/index.d.ts +0 -3
  84. package/benchmark/index.js +0 -20
  85. package/benchmark/slicer.d.ts +0 -101
  86. package/benchmark/slicer.js +0 -225
  87. package/benchmark/stats/index.d.ts +0 -10
  88. package/benchmark/stats/index.js +0 -27
  89. package/benchmark/stats/print.d.ts +0 -7
  90. package/benchmark/stats/print.js +0 -157
  91. package/benchmark/stats/stats.d.ts +0 -41
  92. package/benchmark/stats/stats.js +0 -6
  93. package/benchmark/stopwatch.d.ts +0 -35
  94. package/benchmark/stopwatch.js +0 -79
  95. package/cli/benchmark-app.d.ts +0 -9
  96. package/cli/benchmark-app.js +0 -52
  97. package/cli/benchmark-helper-app.d.ts +0 -7
  98. package/cli/benchmark-helper-app.js +0 -60
  99. package/cli/common/features.d.ts +0 -3
  100. package/cli/common/features.js +0 -30
  101. package/cli/common/index.d.ts +0 -2
  102. package/cli/common/index.js +0 -19
  103. package/cli/common/options.d.ts +0 -20
  104. package/cli/common/options.js +0 -82
  105. package/cli/common/script.d.ts +0 -21
  106. package/cli/common/script.js +0 -61
  107. package/cli/common/scripts-info.d.ts +0 -24
  108. package/cli/common/scripts-info.js +0 -69
  109. package/cli/export-quads-app.d.ts +0 -7
  110. package/cli/export-quads-app.js +0 -46
  111. package/cli/repl/commands/cfg.d.ts +0 -3
  112. package/cli/repl/commands/cfg.js +0 -37
  113. package/cli/repl/commands/commands.d.ts +0 -11
  114. package/cli/repl/commands/commands.js +0 -103
  115. package/cli/repl/commands/dataflow.d.ts +0 -3
  116. package/cli/repl/commands/dataflow.js +0 -34
  117. package/cli/repl/commands/execute.d.ts +0 -4
  118. package/cli/repl/commands/execute.js +0 -27
  119. package/cli/repl/commands/index.d.ts +0 -2
  120. package/cli/repl/commands/index.js +0 -19
  121. package/cli/repl/commands/main.d.ts +0 -39
  122. package/cli/repl/commands/main.js +0 -14
  123. package/cli/repl/commands/normalize.d.ts +0 -3
  124. package/cli/repl/commands/normalize.js +0 -34
  125. package/cli/repl/commands/parse.d.ts +0 -2
  126. package/cli/repl/commands/parse.js +0 -109
  127. package/cli/repl/commands/quit.d.ts +0 -2
  128. package/cli/repl/commands/quit.js +0 -12
  129. package/cli/repl/commands/version.d.ts +0 -16
  130. package/cli/repl/commands/version.js +0 -33
  131. package/cli/repl/core.d.ts +0 -39
  132. package/cli/repl/core.js +0 -116
  133. package/cli/repl/execute.d.ts +0 -28
  134. package/cli/repl/execute.js +0 -79
  135. package/cli/repl/index.d.ts +0 -5
  136. package/cli/repl/index.js +0 -22
  137. package/cli/repl/prompt.d.ts +0 -2
  138. package/cli/repl/prompt.js +0 -9
  139. package/cli/repl/server/connection.d.ts +0 -21
  140. package/cli/repl/server/connection.js +0 -218
  141. package/cli/repl/server/messages/analysis.d.ts +0 -71
  142. package/cli/repl/server/messages/analysis.js +0 -21
  143. package/cli/repl/server/messages/error.d.ts +0 -11
  144. package/cli/repl/server/messages/error.js +0 -3
  145. package/cli/repl/server/messages/hello.d.ts +0 -20
  146. package/cli/repl/server/messages/hello.js +0 -3
  147. package/cli/repl/server/messages/index.d.ts +0 -1
  148. package/cli/repl/server/messages/index.js +0 -3
  149. package/cli/repl/server/messages/messages.d.ts +0 -35
  150. package/cli/repl/server/messages/messages.js +0 -40
  151. package/cli/repl/server/messages/repl.d.ts +0 -33
  152. package/cli/repl/server/messages/repl.js +0 -37
  153. package/cli/repl/server/messages/slice.d.ts +0 -25
  154. package/cli/repl/server/messages/slice.js +0 -37
  155. package/cli/repl/server/net.d.ts +0 -49
  156. package/cli/repl/server/net.js +0 -63
  157. package/cli/repl/server/send.d.ts +0 -4
  158. package/cli/repl/server/send.js +0 -18
  159. package/cli/repl/server/server.d.ts +0 -20
  160. package/cli/repl/server/server.js +0 -66
  161. package/cli/repl/server/validate.d.ts +0 -15
  162. package/cli/repl/server/validate.js +0 -34
  163. package/cli/slicer-app.d.ts +0 -11
  164. package/cli/slicer-app.js +0 -81
  165. package/cli/statistics-app.d.ts +0 -11
  166. package/cli/statistics-app.js +0 -98
  167. package/cli/statistics-helper-app.d.ts +0 -11
  168. package/cli/statistics-helper-app.js +0 -83
  169. package/cli/summarizer-app.d.ts +0 -18
  170. package/cli/summarizer-app.js +0 -67
  171. package/flowr.d.ts +0 -27
  172. package/flowr.js +0 -137
  173. package/r-bridge/lang-4.x/ast/parser/xml/config.d.ts +0 -25
  174. package/r-bridge/lang-4.x/ast/parser/xml/config.js +0 -16
  175. package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.d.ts +0 -9
  176. package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.js +0 -51
  177. package/r-bridge/lang-4.x/ast/parser/xml/parser.d.ts +0 -17
  178. package/r-bridge/lang-4.x/ast/parser/xml/parser.js +0 -30
  179. package/statistics/features/common-syntax-probability.d.ts +0 -31
  180. package/statistics/features/common-syntax-probability.js +0 -156
  181. package/statistics/features/feature.d.ts +0 -175
  182. package/statistics/features/feature.js +0 -30
  183. package/statistics/features/index.d.ts +0 -1
  184. package/statistics/features/index.js +0 -18
  185. package/statistics/features/post-processing.d.ts +0 -12
  186. package/statistics/features/post-processing.js +0 -21
  187. package/statistics/features/supported/assignments/assignments.d.ts +0 -11
  188. package/statistics/features/supported/assignments/assignments.js +0 -53
  189. package/statistics/features/supported/assignments/index.d.ts +0 -1
  190. package/statistics/features/supported/assignments/index.js +0 -6
  191. package/statistics/features/supported/assignments/post-process.d.ts +0 -3
  192. package/statistics/features/supported/assignments/post-process.js +0 -125
  193. package/statistics/features/supported/comments/comments.d.ts +0 -18
  194. package/statistics/features/supported/comments/comments.js +0 -133
  195. package/statistics/features/supported/comments/index.d.ts +0 -1
  196. package/statistics/features/supported/comments/index.js +0 -6
  197. package/statistics/features/supported/comments/post-process.d.ts +0 -3
  198. package/statistics/features/supported/comments/post-process.js +0 -50
  199. package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
  200. package/statistics/features/supported/control-flow/control-flow.js +0 -67
  201. package/statistics/features/supported/control-flow/index.d.ts +0 -1
  202. package/statistics/features/supported/control-flow/index.js +0 -6
  203. package/statistics/features/supported/control-flow/post-process.d.ts +0 -3
  204. package/statistics/features/supported/control-flow/post-process.js +0 -65
  205. package/statistics/features/supported/data-access/data-access.d.ts +0 -15
  206. package/statistics/features/supported/data-access/data-access.js +0 -118
  207. package/statistics/features/supported/data-access/index.d.ts +0 -1
  208. package/statistics/features/supported/data-access/index.js +0 -6
  209. package/statistics/features/supported/data-access/post-process.d.ts +0 -3
  210. package/statistics/features/supported/data-access/post-process.js +0 -107
  211. package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -35
  212. package/statistics/features/supported/defined-functions/defined-functions.js +0 -139
  213. package/statistics/features/supported/defined-functions/index.d.ts +0 -1
  214. package/statistics/features/supported/defined-functions/index.js +0 -6
  215. package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
  216. package/statistics/features/supported/defined-functions/post-process.js +0 -177
  217. package/statistics/features/supported/expression-list/expression-list.d.ts +0 -9
  218. package/statistics/features/supported/expression-list/expression-list.js +0 -36
  219. package/statistics/features/supported/expression-list/index.d.ts +0 -1
  220. package/statistics/features/supported/expression-list/index.js +0 -6
  221. package/statistics/features/supported/expression-list/post-process.d.ts +0 -3
  222. package/statistics/features/supported/expression-list/post-process.js +0 -44
  223. package/statistics/features/supported/index.d.ts +0 -10
  224. package/statistics/features/supported/index.js +0 -27
  225. package/statistics/features/supported/loops/index.d.ts +0 -1
  226. package/statistics/features/supported/loops/index.js +0 -6
  227. package/statistics/features/supported/loops/loops.d.ts +0 -20
  228. package/statistics/features/supported/loops/loops.js +0 -79
  229. package/statistics/features/supported/loops/post-process.d.ts +0 -3
  230. package/statistics/features/supported/loops/post-process.js +0 -72
  231. package/statistics/features/supported/used-functions/index.d.ts +0 -1
  232. package/statistics/features/supported/used-functions/index.js +0 -6
  233. package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
  234. package/statistics/features/supported/used-functions/post-process.js +0 -179
  235. package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
  236. package/statistics/features/supported/used-functions/used-functions.js +0 -95
  237. package/statistics/features/supported/used-packages/index.d.ts +0 -1
  238. package/statistics/features/supported/used-packages/index.js +0 -6
  239. package/statistics/features/supported/used-packages/post-process.d.ts +0 -3
  240. package/statistics/features/supported/used-packages/post-process.js +0 -121
  241. package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
  242. package/statistics/features/supported/used-packages/used-packages.js +0 -130
  243. package/statistics/features/supported/values/index.d.ts +0 -1
  244. package/statistics/features/supported/values/index.js +0 -6
  245. package/statistics/features/supported/values/post-process.d.ts +0 -3
  246. package/statistics/features/supported/values/post-process.js +0 -72
  247. package/statistics/features/supported/values/values.d.ts +0 -14
  248. package/statistics/features/supported/values/values.js +0 -101
  249. package/statistics/features/supported/variables/index.d.ts +0 -1
  250. package/statistics/features/supported/variables/index.js +0 -6
  251. package/statistics/features/supported/variables/post-process.d.ts +0 -9
  252. package/statistics/features/supported/variables/post-process.js +0 -122
  253. package/statistics/features/supported/variables/variables.d.ts +0 -15
  254. package/statistics/features/supported/variables/variables.js +0 -70
  255. package/statistics/index.d.ts +0 -6
  256. package/statistics/index.js +0 -24
  257. package/statistics/meta-statistics.d.ts +0 -33
  258. package/statistics/meta-statistics.js +0 -17
  259. package/statistics/output/file-provider.d.ts +0 -37
  260. package/statistics/output/file-provider.js +0 -97
  261. package/statistics/output/index.d.ts +0 -4
  262. package/statistics/output/index.js +0 -21
  263. package/statistics/output/print-stats.d.ts +0 -17
  264. package/statistics/output/print-stats.js +0 -69
  265. package/statistics/output/statistics-file.d.ts +0 -37
  266. package/statistics/output/statistics-file.js +0 -69
  267. package/statistics/statistics.d.ts +0 -24
  268. package/statistics/statistics.js +0 -109
  269. package/util/summarizer/auto-detect.d.ts +0 -2
  270. package/util/summarizer/auto-detect.js +0 -32
  271. package/util/summarizer/benchmark/data.d.ts +0 -66
  272. package/util/summarizer/benchmark/data.js +0 -13
  273. package/util/summarizer/benchmark/first-phase/input.d.ts +0 -2
  274. package/util/summarizer/benchmark/first-phase/input.js +0 -59
  275. package/util/summarizer/benchmark/first-phase/process.d.ts +0 -10
  276. package/util/summarizer/benchmark/first-phase/process.js +0 -208
  277. package/util/summarizer/benchmark/second-phase/graph.d.ts +0 -2
  278. package/util/summarizer/benchmark/second-phase/graph.js +0 -54
  279. package/util/summarizer/benchmark/second-phase/process.d.ts +0 -4
  280. package/util/summarizer/benchmark/second-phase/process.js +0 -89
  281. package/util/summarizer/benchmark/summarizer.d.ts +0 -35
  282. package/util/summarizer/benchmark/summarizer.js +0 -49
  283. package/util/summarizer/statistics/first-phase/process.d.ts +0 -6
  284. package/util/summarizer/statistics/first-phase/process.js +0 -81
  285. package/util/summarizer/statistics/post-process/clusterer.d.ts +0 -26
  286. package/util/summarizer/statistics/post-process/clusterer.js +0 -43
  287. package/util/summarizer/statistics/post-process/file-based-count.d.ts +0 -17
  288. package/util/summarizer/statistics/post-process/file-based-count.js +0 -49
  289. package/util/summarizer/statistics/post-process/histogram.d.ts +0 -59
  290. package/util/summarizer/statistics/post-process/histogram.js +0 -128
  291. package/util/summarizer/statistics/post-process/index.d.ts +0 -4
  292. package/util/summarizer/statistics/post-process/index.js +0 -21
  293. package/util/summarizer/statistics/post-process/post-process-output.d.ts +0 -16
  294. package/util/summarizer/statistics/post-process/post-process-output.js +0 -104
  295. package/util/summarizer/statistics/second-phase/process.d.ts +0 -11
  296. package/util/summarizer/statistics/second-phase/process.js +0 -117
  297. package/util/summarizer/statistics/summarizer.d.ts +0 -35
  298. package/util/summarizer/statistics/summarizer.js +0 -135
  299. package/util/summarizer/summarizer.js +0 -13
  300. /package/{statistics/output → util}/ansi.d.ts +0 -0
@@ -1,79 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Measurements = void 0;
4
- const assert_1 = require("../util/assert");
5
- /** unguarded start-stop wrapper */
6
- class Stopwatch {
7
- timeStart;
8
- timeEnd;
9
- stopped = false;
10
- start() {
11
- this.timeStart = process.hrtime.bigint();
12
- }
13
- stop() {
14
- this.timeEnd = process.hrtime.bigint();
15
- // check after to not affect measurements
16
- (0, assert_1.guard)(!this.stopped, 'cannot stop a stopwatch twice');
17
- this.stopped = true;
18
- }
19
- get() {
20
- (0, assert_1.guard)(this.timeStart !== undefined && this.timeEnd !== undefined, 'cannot get elapsed time as the stopwatch has not been started/stopped');
21
- return this.timeEnd - this.timeStart;
22
- }
23
- }
24
- /**
25
- * Allows to measure keys of type `T` with a `Stopwatch`.
26
- *
27
- * Measure with {@link start}, {@link measure} or {@link measureAsync}, retrieve the final measurements with {@link get}.
28
- */
29
- class Measurements {
30
- measurements = new Map();
31
- /**
32
- * Start a timer for the given key, and guards that this is the first time this key is started.
33
- * Call {@link IStoppableStopwatch#stop} on the returned stopwatch to stop the timer.
34
- */
35
- start(key) {
36
- // we guard *before* starting so there is no additional time penalty
37
- (0, assert_1.guard)(!this.measurements.has(key), `already started stop watch for ${JSON.stringify(key)}`);
38
- const stopwatch = new Stopwatch();
39
- this.measurements.set(key, stopwatch);
40
- stopwatch.start();
41
- return stopwatch;
42
- }
43
- /**
44
- * Automatically call {@link Measurements#start | start} and the corresponding stop to measure the execution time of the given function.
45
- * @see {@link measureAsync}
46
- */
47
- measure(key, fn) {
48
- const stopwatch = this.start(key);
49
- const result = fn();
50
- stopwatch.stop();
51
- return result;
52
- }
53
- /**
54
- * Similar to {@link measure}, but await the promise as part of the measurement
55
- *
56
- * @param key - The key to write the resulting measurement to
57
- * @param fn - The function to measure
58
- *
59
- * @see measure
60
- */
61
- async measureAsync(key, fn) {
62
- const stopwatch = this.start(key);
63
- const result = await fn();
64
- stopwatch.stop();
65
- return result;
66
- }
67
- /**
68
- * Retrieve all measure-results, requires that all stop-watches that have been started have also been stopped.
69
- */
70
- get() {
71
- const result = new Map();
72
- for (const [key, stopwatch] of this.measurements) {
73
- result.set(key, stopwatch.get());
74
- }
75
- return result;
76
- }
77
- }
78
- exports.Measurements = Measurements;
79
- //# sourceMappingURL=stopwatch.js.map
@@ -1,9 +0,0 @@
1
- export interface BenchmarkCliOptions {
2
- verbose: boolean;
3
- help: boolean;
4
- input: string[];
5
- output: string;
6
- slice: string;
7
- parallel: number;
8
- limit?: number;
9
- }
@@ -1,52 +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
- const log_1 = require("../util/log");
7
- const files_1 = require("../util/files");
8
- const parallel_1 = require("../util/parallel");
9
- const assert_1 = require("../util/assert");
10
- const fs_1 = __importDefault(require("fs"));
11
- const common_1 = require("./common");
12
- const options = (0, common_1.processCommandLineArgs)('benchmark', [], {
13
- subtitle: 'Slice given files with additional benchmark information',
14
- examples: [
15
- '{italic example-folder/}',
16
- '{bold --help}'
17
- ]
18
- });
19
- if (options.input.length === 0) {
20
- console.error('No input files given. Nothing to do. See \'--help\' if this is an error.');
21
- process.exit(0);
22
- }
23
- (0, assert_1.guard)(options.slice === 'all' || options.slice === 'no', 'slice must be either all or no');
24
- function removeIfExists(summarizedRaw) {
25
- if (fs_1.default.existsSync(summarizedRaw)) {
26
- console.log(`Removing existing ${summarizedRaw}`);
27
- fs_1.default.unlinkSync(summarizedRaw);
28
- }
29
- }
30
- async function benchmark() {
31
- removeIfExists(options.output);
32
- console.log(`Writing output continuously to ${options.output}`);
33
- console.log(`Using ${options.parallel} parallel executors`);
34
- // we do not use the limit argument to be able to pick the limit randomly
35
- const files = [];
36
- for await (const file of (0, files_1.allRFilesFrom)(options.input)) {
37
- files.push(file);
38
- }
39
- if (options.limit) {
40
- log_1.log.info(`limiting to ${options.limit} files`);
41
- // shuffle and limit
42
- files.sort(() => Math.random() - 0.5);
43
- }
44
- const limit = options.limit ?? files.length;
45
- const verboseAdd = options.verbose ? ['--verbose'] : [];
46
- const pool = new parallel_1.LimitedThreadPool(`${__dirname}/benchmark-helper-app`, files.map(f => [f.content, '--output', options.output, '--slice', options.slice, ...verboseAdd]), limit, options.parallel);
47
- await pool.run();
48
- const stats = pool.getStats();
49
- console.log(`Benchmarked ${stats.counter} files, skipped ${stats.skipped.length} files due to errors`);
50
- }
51
- void benchmark();
52
- //# sourceMappingURL=benchmark-app.js.map
@@ -1,7 +0,0 @@
1
- export interface SingleBenchmarkCliOptions {
2
- verbose: boolean;
3
- help: boolean;
4
- input?: string;
5
- slice: string;
6
- output?: string;
7
- }
@@ -1,60 +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
- const log_1 = require("../util/log");
7
- const benchmark_1 = require("../benchmark");
8
- const slicing_1 = require("../slicing");
9
- const fs_1 = __importDefault(require("fs"));
10
- const json_1 = require("../util/json");
11
- const assert_1 = require("../util/assert");
12
- const common_1 = require("./common");
13
- const options = (0, common_1.processCommandLineArgs)('benchmark-helper', [], {
14
- subtitle: 'Will slice for all possible variables, signal by exit code if slicing was successful, and can be run standalone',
15
- examples: [
16
- '{italic example-file.R} --output {italic output.json}',
17
- '{bold --help}'
18
- ]
19
- });
20
- if (options.verbose) {
21
- log_1.log.error('running with *verbose* setting - do not use for final benchmark', options);
22
- }
23
- (0, assert_1.guard)(options.slice === 'all' || options.slice === 'no', 'slice must be either all or no');
24
- async function benchmark() {
25
- // we do not use the limit argument to be able to pick the limit randomly
26
- (0, assert_1.guard)(options.input !== undefined, 'No input file given');
27
- (0, assert_1.guard)(options.output !== undefined, 'No output file given');
28
- console.log(`[${options.input}] Appending output to ${options.output}`);
29
- // ensure the file exists
30
- const fileStat = fs_1.default.statSync(options.input);
31
- (0, assert_1.guard)(fileStat.isFile(), `File ${options.input} does not exist or is no file`);
32
- const request = { request: 'file', content: options.input };
33
- const slicer = new benchmark_1.BenchmarkSlicer();
34
- try {
35
- await slicer.init(request);
36
- // ${escape}1F${escape}1G${escape}2K for line reset
37
- if (options.slice === 'all') {
38
- const count = await slicer.sliceForAll(slicing_1.DefaultAllVariablesFilter, (i, total, arr) => console.log(`[${options.input}] Slicing ${i + 1}/${total} [${JSON.stringify(arr[i])}]`));
39
- console.log(`[${options.input}] Completed Slicing`);
40
- (0, assert_1.guard)(count > 0, `No possible slices found for ${options.input}, skipping in count`);
41
- }
42
- else {
43
- console.log(`[${options.input}] Skipping Slicing due to --slice=${options.slice}`);
44
- }
45
- const { stats } = slicer.finish();
46
- // append line by line
47
- fs_1.default.appendFileSync(options.output, `${JSON.stringify({ filename: options.input, stats }, json_1.jsonReplacer)}\n`);
48
- }
49
- catch (e) {
50
- if (e instanceof Error) {
51
- if (!e.message.includes('unable to parse R')) {
52
- console.log(`[${options.input}] Non R-Side error : ${e.message}`);
53
- }
54
- }
55
- slicer.ensureSessionClosed(); // ensure finish
56
- throw e;
57
- }
58
- }
59
- void benchmark();
60
- //# sourceMappingURL=benchmark-helper-app.js.map
@@ -1,3 +0,0 @@
1
- import type { FeatureKey } from '../../statistics';
2
- export declare function validateFeatures(features: (string[] | ['all'] | FeatureKey[])): Set<FeatureKey>;
3
- export declare function retrieveArchiveName(p: string): string;
@@ -1,30 +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.retrieveArchiveName = exports.validateFeatures = void 0;
7
- const statistics_1 = require("../../statistics");
8
- const path_1 = __importDefault(require("path"));
9
- function validateFeatures(features) {
10
- for (const feature of features) {
11
- if (feature === 'all') {
12
- if (features.length > 1) {
13
- console.error(`Feature "all" must be the only feature given, got ${features.join(', ')}`);
14
- process.exit(1);
15
- }
16
- }
17
- else if (!statistics_1.allFeatureNames.has(feature)) {
18
- console.error(`Feature ${feature} is unknown, supported are ${[...statistics_1.allFeatureNames].join(', ')} or "all"`);
19
- process.exit(1);
20
- }
21
- }
22
- return features[0] === 'all' ? statistics_1.allFeatureNames : new Set(features);
23
- }
24
- exports.validateFeatures = validateFeatures;
25
- function retrieveArchiveName(p) {
26
- const basepath = path_1.default.normalize(p);
27
- return `${basepath.endsWith(path_1.default.sep) ? basepath.substring(0, basepath.length - 1) : basepath}.tar.gz`;
28
- }
29
- exports.retrieveArchiveName = retrieveArchiveName;
30
- //# sourceMappingURL=features.js.map
@@ -1,2 +0,0 @@
1
- export * from './script';
2
- export * from './scripts-info';
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./script"), exports);
18
- __exportStar(require("./scripts-info"), exports);
19
- //# sourceMappingURL=index.js.map
@@ -1,20 +0,0 @@
1
- import type { OptionDefinition } from 'command-line-usage';
2
- /**
3
- * This interface describes options, that every script *must* provide.
4
- */
5
- export interface CommonOptions {
6
- /** Enables the most verbose logging option available. */
7
- verbose: boolean;
8
- /**
9
- * Shows the respective help including usage examples,
10
- * see {@link processCommandLineArgs} or {@link helpForOptions} for more information.
11
- */
12
- help: boolean;
13
- }
14
- export declare const benchmarkOptions: OptionDefinition[];
15
- export declare const benchmarkHelperOptions: OptionDefinition[];
16
- export declare const exportQuadsOptions: OptionDefinition[];
17
- export declare const slicerOptions: OptionDefinition[];
18
- export declare const statisticOptions: OptionDefinition[];
19
- export declare const statisticHelperOptions: OptionDefinition[];
20
- export declare const summarizerOptions: OptionDefinition[];
@@ -1,82 +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.summarizerOptions = exports.statisticHelperOptions = exports.statisticOptions = exports.slicerOptions = exports.exportQuadsOptions = exports.benchmarkHelperOptions = exports.benchmarkOptions = void 0;
7
- const os_1 = __importDefault(require("os"));
8
- const time_1 = require("../../util/time");
9
- const statistics_1 = require("../../statistics");
10
- /**
11
- * This string contains a string representation of the loading time of this module.
12
- */
13
- const StartTimeString = (0, time_1.date2string)(new Date());
14
- exports.benchmarkOptions = [
15
- { name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging [do not use for the real benchmark as this affects the time measurements, but only to find errors]' },
16
- { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
17
- { name: 'limit', alias: 'l', type: Number, description: 'Limit the number of files to process (if given, this will choose these files randomly and add the chosen names to the output' },
18
- { name: 'input', alias: 'i', type: String, description: 'Pass a folder or file as src to read from', multiple: true, defaultOption: true, defaultValue: [], typeLabel: '{underline files/folders}' },
19
- { name: 'parallel', alias: 'p', type: String, description: 'Number of parallel executors (defaults to {italic max(cpu.count-1, 1)})', defaultValue: Math.max(os_1.default.cpus().length - 1, 1), typeLabel: '{underline number}' },
20
- { name: 'slice', alias: 's', type: String, description: 'Automatically slice for *all* variables (default) or *no* slicing and only parsing/dataflow construction', defaultValue: 'all', typeLabel: '{underline all/no}' },
21
- { name: 'output', alias: 'o', type: String, description: `File to write all the measurements to in a per-file-basis (defaults to {italic benchmark-${StartTimeString}.json})`, defaultValue: `benchmark-${StartTimeString}.json`, typeLabel: '{underline file}' }
22
- ];
23
- exports.benchmarkHelperOptions = [
24
- { name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging [do not use for the real benchmark as this affects the time measurements, but only to find errors]' },
25
- { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
26
- { name: 'input', alias: 'i', type: String, description: 'Pass a single file as src to read from', multiple: false, defaultOption: true, typeLabel: '{underline file}' },
27
- { name: 'slice', alias: 's', type: String, description: 'Automatically slice for *all* variables (default) or *no* slicing and only parsing/dataflow construction', defaultValue: 'all', typeLabel: '{underline all/no}' },
28
- { name: 'output', alias: 'o', type: String, description: 'File to write the measurements to (appends a single line in JSON format)', typeLabel: '{underline file}' },
29
- ];
30
- exports.exportQuadsOptions = [
31
- { name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging' },
32
- { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
33
- { name: 'input', alias: 'i', type: String, description: 'Pass a folder or file as src to read from', multiple: true, defaultOption: true, defaultValue: [], typeLabel: '{underline files/folders}' },
34
- { name: 'limit', alias: 'l', type: Number, description: 'Limit the number of files to process' },
35
- { name: 'output', alias: 'o', type: String, description: 'File to write all the generated quads to (defaults to {italic out.quads})', typeLabel: '{underline file}' },
36
- ];
37
- exports.slicerOptions = [
38
- { name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging' },
39
- { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
40
- { name: 'input', alias: 'i', type: String, description: '(Required) Pass a single file to slice', multiple: false, defaultOption: true, typeLabel: '{underline files}' },
41
- { name: 'input-is-text', alias: 'r', type: Boolean, description: 'Indicate, that the input is *not* a file, but R code to directly consume' },
42
- { name: 'diff', alias: 'd', type: Boolean, description: 'This requires ansi-output and only works if the api option is not set. It visualizes the slice as a diff.' },
43
- { name: 'criterion', alias: 'c', type: String, description: '(Required) Slicing criterion either in the form {underline line:col} or {underline line@variable}, multiple can be separated by \'{bold ;}\'. If you do not want to slice but only process the file, pass an empty string.', multiple: false },
44
- { name: 'stats', alias: 's', type: Boolean, description: 'Print stats and write them to {italic <output>.stats} (runtimes etc.)', multiple: false },
45
- { name: 'output', alias: 'o', type: String, description: 'File to write all the generated quads to (defaults to the commandline)', typeLabel: '{underline file}' },
46
- { name: 'api', type: Boolean, description: 'Instead of human-readable output, dump a lot of json with the results of all intermediate steps.' },
47
- ];
48
- const featureNameList = [...statistics_1.allFeatureNames].map(s => `"${s}"`).join(', ');
49
- exports.statisticOptions = [
50
- { name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging' },
51
- { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
52
- { name: 'limit', alias: 'l', type: Number, description: 'Limit the number of files to process' },
53
- { name: 'input', alias: 'i', type: String, description: 'Pass a folder or file as src to read from', multiple: true, defaultOption: true, defaultValue: [], typeLabel: '{underline files/folders}' },
54
- { name: 'output-dir', alias: 'o', type: String, description: 'Folder to write the output to', defaultValue: `${process.cwd()}/statistics-out/${(0, time_1.date2string)(new Date())}`, typeLabel: '{underline folder}' },
55
- { name: 'dump-json', type: Boolean, description: 'Write JSON output during the extraction', typeLabel: '{underline folder}' },
56
- { name: 'no-ansi', type: Boolean, description: 'Disable ansi-escape-sequences in the output. Useful, if you want to redirect the output to a file.' },
57
- { name: 'parallel', alias: 'p', type: String, description: 'Number of parallel executors (defaults to {italic max(cpu.count-1, 1)})', defaultValue: Math.max(os_1.default.cpus().length - 1, 1), typeLabel: '{underline number}' },
58
- { name: 'features', type: String, description: `Features to track, supported are "all" or ${featureNameList}`, multiple: true, defaultValue: 'all', typeLabel: '{underline names}' },
59
- ];
60
- exports.statisticHelperOptions = [
61
- { name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging' },
62
- { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
63
- { name: 'input', alias: 'i', type: String, description: 'Pass single file as src to read from', multiple: false, defaultOption: true, typeLabel: '{underline file}' },
64
- { name: 'output-dir', alias: 'o', type: String, description: 'Folder to write the output to', typeLabel: '{underline folder}' },
65
- { name: 'root-dir', type: String, description: 'Root dir for the statistics files', defaultValue: '' },
66
- { name: 'compress', type: Boolean, description: 'Compress the output folder to a single file', defaultValue: false },
67
- { name: 'dump-json', type: Boolean, description: 'Write JSON output during the extraction', typeLabel: '{underline folder}' },
68
- { name: 'no-ansi', type: Boolean, description: 'Disable ansi-escape-sequences in the output. Useful, if you want to redirect the output to a file.' },
69
- { name: 'features', type: String, description: `Features to track, supported are "all" or ${featureNameList}`, multiple: true, defaultValue: 'all', typeLabel: '{underline names}' },
70
- ];
71
- exports.summarizerOptions = [
72
- { name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging' },
73
- { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
74
- { name: 'type', alias: 't', type: String, description: 'Manually specify if you want to post-process benchmark results, statistics, or compressed statistics (defaults to auto).', defaultValue: 'auto' },
75
- { name: 'graph', alias: 'g', type: Boolean, description: 'Produce data to be used for visualizing benchmarks over time' },
76
- { name: 'categorize', type: Boolean, description: 'Categorize the results (e.g., "test", "example", ...)', defaultValue: false },
77
- { name: 'project-skip', type: Number, description: 'Skip the first n folders to find the location of projects', defaultValue: 0 },
78
- { name: 'ultimate-only', alias: 'u', type: Boolean, description: 'Only perform the second summary-stage, with this, the input is used to find the summary-output.' },
79
- { name: 'input', alias: 'i', type: String, description: 'The {italic output} produced by the benchmark, the statistics, ...', defaultOption: true, multiple: false, typeLabel: '{underline file.json/output}' },
80
- { name: 'output', alias: 'o', type: String, description: 'Basename of the summaries (defaults to {italic <input>-summary})', typeLabel: '{underline file}' },
81
- ];
82
- //# sourceMappingURL=options.js.map
@@ -1,21 +0,0 @@
1
- /**
2
- * The goal of this module is simply to streamline the creation of new scripts.
3
- *
4
- * @module
5
- */
6
- import { scripts } from './scripts-info';
7
- import type { CommonOptions } from './options';
8
- /**
9
- * Just a helping data structure to allow the user to provide example usages of the respective script.
10
- * The subtitle will be displayed next to the title.
11
- */
12
- export interface HelpContent {
13
- subtitle: string;
14
- examples: string[];
15
- }
16
- /**
17
- * Automatically generates a uniform help from a given script (see {@link scripts}).
18
- * Additionally, you can pass usage examples that may make use of the formatting instructions `{italic x}` and `{bold x}`.
19
- */
20
- export declare function helpForOptions(script: keyof typeof scripts, content: HelpContent): string;
21
- export declare function processCommandLineArgs<T extends CommonOptions>(script: keyof typeof scripts, requireAdditionally: (keyof T)[], help: HelpContent): T;
@@ -1,61 +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.processCommandLineArgs = exports.helpForOptions = void 0;
7
- /**
8
- * The goal of this module is simply to streamline the creation of new scripts.
9
- *
10
- * @module
11
- */
12
- const scripts_info_1 = require("./scripts-info");
13
- const command_line_usage_1 = __importDefault(require("command-line-usage"));
14
- const log_1 = require("../../util/log");
15
- const command_line_args_1 = __importDefault(require("command-line-args"));
16
- const statistics_1 = require("../../statistics");
17
- /**
18
- * Automatically generates a uniform help from a given script (see {@link scripts}).
19
- * Additionally, you can pass usage examples that may make use of the formatting instructions `{italic x}` and `{bold x}`.
20
- */
21
- function helpForOptions(script, content) {
22
- return (0, command_line_usage_1.default)([
23
- {
24
- header: scripts_info_1.scripts[script].description,
25
- content: content.subtitle
26
- },
27
- {
28
- header: 'Synopsis',
29
- content: content.examples.map(e => `$ ${scripts_info_1.scripts[script].toolName} ${e}`)
30
- },
31
- {
32
- header: 'Options',
33
- optionList: scripts_info_1.scripts[script].options
34
- }
35
- ]);
36
- }
37
- exports.helpForOptions = helpForOptions;
38
- function processCommandLineArgs(script, requireAdditionally, help) {
39
- const options = (0, command_line_args_1.default)(scripts_info_1.scripts[script].options);
40
- if (options.help) {
41
- console.log(helpForOptions(script, help));
42
- process.exit(0);
43
- }
44
- else if (requireAdditionally.length > 0) {
45
- const keys = new Set(Object.keys(options));
46
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- we know that they are not given if undefined
47
- const missing = requireAdditionally.filter(k => !keys.has(k) || options[k] === undefined);
48
- if (missing.length > 0) {
49
- console.error((0, statistics_1.italic)(`Missing required arguments: ${missing.join(', ')}. Showing help.`));
50
- console.log(helpForOptions(script, help));
51
- process.exit(0);
52
- }
53
- }
54
- log_1.log.updateSettings(l => l.settings.minLevel = options.verbose ? 1 /* LogLevel.Trace */ : 5 /* LogLevel.Error */);
55
- if (options.verbose) {
56
- log_1.log.info(`running with (debugging) options, ${JSON.stringify(options)}`);
57
- }
58
- return options;
59
- }
60
- exports.processCommandLineArgs = processCommandLineArgs;
61
- //# sourceMappingURL=script.js.map
@@ -1,24 +0,0 @@
1
- /**
2
- * This file contains the references to all scripts, as well as their explanations and arguments.
3
- *
4
- * @module
5
- */
6
- import type { MergeableRecord } from '../../util/objects';
7
- import type { OptionDefinition } from 'command-line-usage';
8
- interface BaseScriptInformation extends MergeableRecord {
9
- toolName: string;
10
- target: string;
11
- description: string;
12
- usageExample: string;
13
- options: OptionDefinition[];
14
- }
15
- export interface MasterScriptInformation extends BaseScriptInformation {
16
- type: 'master script';
17
- }
18
- export interface HelperScriptInformation extends BaseScriptInformation {
19
- type: 'helper script';
20
- masterScripts: string[];
21
- }
22
- export type ScriptInformation = MasterScriptInformation | HelperScriptInformation;
23
- export declare const scripts: Record<"slicer" | "benchmark" | "stats" | "summarizer" | "export-quads" | "stats-helper" | "benchmark-helper", ScriptInformation>;
24
- export {};
@@ -1,69 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.scripts = void 0;
4
- const options_1 = require("./options");
5
- /**
6
- * We hold `_scripts` internally, as the modifiable variant and export the readonly scripts
7
- */
8
- const _scripts = {
9
- 'slicer': {
10
- toolName: 'slicer',
11
- target: 'slicer-app',
12
- description: 'Static backwards executable slicer for R',
13
- options: options_1.slicerOptions,
14
- usageExample: 'slicer -c "12@product" test/testfiles/example.R',
15
- type: 'master script',
16
- },
17
- 'benchmark': {
18
- toolName: 'benchmark',
19
- target: 'benchmark-app',
20
- description: 'Benchmark the static backwards slicer',
21
- type: 'master script',
22
- usageExample: 'benchmark "example-folder/"',
23
- options: options_1.benchmarkOptions
24
- },
25
- 'benchmark-helper': {
26
- toolName: 'benchmark-single',
27
- target: 'benchmark-helper-app',
28
- description: 'Helper Script to Benchmark the Slicer',
29
- usageExample: 'benchmark-single "example.R" --output "example.json"',
30
- options: options_1.benchmarkHelperOptions,
31
- type: 'helper script',
32
- masterScripts: ['benchmark']
33
- },
34
- 'summarizer': {
35
- toolName: 'summarizer',
36
- target: 'summarizer-app',
37
- description: 'Summarize the results of the benchmark',
38
- options: options_1.summarizerOptions,
39
- usageExample: 'summarizer "benchmark.json"',
40
- type: 'master script',
41
- },
42
- 'export-quads': {
43
- toolName: 'export-quads',
44
- target: 'export-quads-app',
45
- description: 'Export quads of the normalized AST of a given R code file',
46
- usageExample: 'export-quads "example.R" --output "example.quads"',
47
- options: options_1.exportQuadsOptions,
48
- type: 'master script',
49
- },
50
- 'stats': {
51
- toolName: 'stats',
52
- target: 'statistics-app',
53
- description: 'Generate usage Statistics for R scripts',
54
- options: options_1.statisticOptions,
55
- usageExample: 'stats -i example.R --output-dir "output-folder/"',
56
- type: 'master script',
57
- },
58
- 'stats-helper': {
59
- toolName: 'stats-helper',
60
- target: 'statistics-helper-app',
61
- description: 'Generate usage Statistics for a single R script (parallel helper for stats)',
62
- options: options_1.statisticHelperOptions,
63
- usageExample: 'stats-helper -i example.R --output-dir "output-folder/"',
64
- type: 'helper script',
65
- masterScripts: ['stats']
66
- }
67
- };
68
- exports.scripts = _scripts;
69
- //# sourceMappingURL=scripts-info.js.map
@@ -1,7 +0,0 @@
1
- export interface QuadsCliOptions {
2
- verbose: boolean;
3
- help: boolean;
4
- input: string[];
5
- limit: number;
6
- output: string | undefined;
7
- }
@@ -1,46 +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
- const r_bridge_1 = require("../r-bridge");
7
- const log_1 = require("../util/log");
8
- const quads_1 = require("../util/quads");
9
- const fs_1 = __importDefault(require("fs"));
10
- const files_1 = require("../util/files");
11
- const common_1 = require("./common");
12
- const options = (0, common_1.processCommandLineArgs)('export-quads', [], {
13
- subtitle: 'Generate RDF N-Quads from the AST of a given R script',
14
- examples: [
15
- '{bold -i} {italic example.R} {bold --output} {italic "example.quads"}',
16
- '{bold --help}'
17
- ]
18
- });
19
- const shell = new r_bridge_1.RShell();
20
- shell.tryToInjectHomeLibPath();
21
- async function writeQuadForSingleFile(request, output) {
22
- const normalized = await (0, r_bridge_1.retrieveNormalizedAstFromRCode)({
23
- ...request,
24
- ensurePackageInstalled: true
25
- }, shell);
26
- const serialized = (0, quads_1.serialize2quads)(normalized.ast, { context: request.content });
27
- log_1.log.info(`Appending quads to ${output}`);
28
- fs_1.default.appendFileSync(output, serialized);
29
- }
30
- async function getQuads() {
31
- const output = options.output ?? 'out.quads';
32
- let skipped = 0;
33
- for await (const request of (0, files_1.allRFilesFrom)(options.input, options.limit)) {
34
- try {
35
- await writeQuadForSingleFile(request, output);
36
- }
37
- catch (e) {
38
- log_1.log.error(`[Skipped] Error while processing ${request.content}: ${e.message} (${e.stack ?? ''})`);
39
- skipped++;
40
- }
41
- }
42
- console.log(`Skipped ${skipped} files`);
43
- shell.close();
44
- }
45
- void getQuads();
46
- //# sourceMappingURL=export-quads-app.js.map
@@ -1,3 +0,0 @@
1
- import type { ReplCommand } from './main';
2
- export declare const controlflowCommand: ReplCommand;
3
- export declare const controlflowStarCommand: ReplCommand;