@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,98 +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 statistics_1 = require("../statistics");
7
- const log_1 = require("../util/log");
8
- const files_1 = require("../util/files");
9
- const common_1 = require("./common");
10
- const parallel_1 = require("../util/parallel");
11
- const features_1 = require("./common/features");
12
- const path_1 = __importDefault(require("path"));
13
- const json_1 = require("../util/json");
14
- const fs_1 = __importDefault(require("fs"));
15
- const options = (0, common_1.processCommandLineArgs)('stats', [], {
16
- subtitle: 'Given input files or folders, this will collect usage statistics for the given features and write them to a file',
17
- examples: [
18
- '{bold -i} {italic example.R} {bold -i} {italic example2.R} {bold --output-dir} {italic "output-folder/"}',
19
- '{italic "folder1/"} {bold --features} {italic all} {bold --output-dir} {italic "output-folder/"}',
20
- '{bold --post-process} {italic "output-folder"} {bold --features} {italic assignments}',
21
- '{bold --help}'
22
- ]
23
- });
24
- if (options.input.length === 0) {
25
- console.error('No input files given. Nothing to do. See \'--help\' if this is an error.');
26
- process.exit(0);
27
- }
28
- if (options['no-ansi']) {
29
- log_1.log.info('disabling ansi colors');
30
- (0, statistics_1.setFormatter)(statistics_1.voidFormatter);
31
- }
32
- const processedFeatures = (0, features_1.validateFeatures)(options.features);
33
- (0, statistics_1.initFileProvider)(options['output-dir']);
34
- const testRegex = /[^/]*\/test/i;
35
- const exampleRegex = /[^/]*\/example/i;
36
- function getPrefixForFile(file) {
37
- if (testRegex.test(file)) {
38
- return 'test-';
39
- }
40
- else if (exampleRegex.test(file)) {
41
- return 'example-';
42
- }
43
- else {
44
- return '';
45
- }
46
- }
47
- function getSuffixForFile(base, file) {
48
- const subpath = path_1.default.relative(base, file);
49
- return '--' + subpath.replace(/\//g, '/');
50
- }
51
- async function collectFileArguments(verboseAdd, dumpJson, features) {
52
- const files = [];
53
- let counter = 0;
54
- let presentSteps = 5000;
55
- let skipped = 0;
56
- for await (const f of (0, files_1.allRFilesFrom)(options.input)) {
57
- const outputDir = path_1.default.join(options['output-dir'], `${getPrefixForFile(f.content)}${getSuffixForFile(options.input.length === 1 ? options.input[0] : '', f.content)}`);
58
- const target = (0, features_1.retrieveArchiveName)(outputDir);
59
- if (fs_1.default.existsSync(target)) {
60
- console.log(`Archive ${target} exists. Skip.`);
61
- skipped++;
62
- continue;
63
- }
64
- files.push(['--input', f.content, '--output-dir', outputDir, '--compress', '--root-dir', options.input.length === 1 ? options.input[0] : '""', ...verboseAdd, ...features, ...dumpJson]);
65
- if (++counter % presentSteps === 0) {
66
- console.log(`Collected ${counter} files`);
67
- if (counter >= 10 * presentSteps) {
68
- presentSteps *= 5;
69
- }
70
- }
71
- }
72
- console.log(`Total: ${counter} files (${skipped} skipped with archive existing)`);
73
- return files;
74
- }
75
- async function getStats() {
76
- console.log(`Processing features: ${JSON.stringify(processedFeatures, json_1.jsonReplacer)}`);
77
- console.log(`Using ${options.parallel} parallel executors`);
78
- const verboseAdd = options.verbose ? ['--verbose'] : [];
79
- const features = [...processedFeatures].flatMap(s => ['--features', s]);
80
- const dumpJson = options['dump-json'] ? ['--dump-json'] : [];
81
- // we do not use the limit argument to be able to pick the limit randomly
82
- const args = await collectFileArguments(verboseAdd, dumpJson, features);
83
- if (options.limit) {
84
- console.log('Shuffle...');
85
- log_1.log.info(`limiting to ${options.limit} files`);
86
- // shuffle and limit
87
- args.sort(() => Math.random() - 0.5);
88
- }
89
- console.log('Prepare Pool...');
90
- const limit = options.limit ?? args.length;
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
- void getStats();
98
- //# 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,83 +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 statistics_1 = require("../statistics");
8
- const log_1 = require("../util/log");
9
- const common_1 = require("./common");
10
- const json_1 = require("../util/json");
11
- const fs_1 = __importDefault(require("fs"));
12
- const assert_1 = require("../util/assert");
13
- const features_1 = require("./common/features");
14
- const core_1 = require("../core");
15
- const time_1 = require("../util/time");
16
- const tar_1 = require("tar");
17
- const cfg_1 = require("../util/cfg/cfg");
18
- const options = (0, common_1.processCommandLineArgs)('stats-helper', [], {
19
- subtitle: 'Given a single input file, this will collect usage statistics for the given features and write them to a file',
20
- examples: [
21
- '{bold -i} {italic example.R} {bold -i} {italic example2.R} {bold --output-dir} {italic "output-folder/"}',
22
- '{bold --help}'
23
- ]
24
- });
25
- if (options['no-ansi']) {
26
- log_1.log.info('disabling ansi colors');
27
- (0, statistics_1.setFormatter)(statistics_1.voidFormatter);
28
- }
29
- let target = undefined;
30
- if (options.compress) {
31
- target = (0, features_1.retrieveArchiveName)(options['output-dir']);
32
- if (fs_1.default.existsSync(target)) {
33
- console.log(`Archive ${target} exists. Skip.`);
34
- process.exit(0);
35
- }
36
- }
37
- // assume correct
38
- const processedFeatures = new Set(options.features);
39
- const shell = new r_bridge_1.RShell();
40
- shell.tryToInjectHomeLibPath();
41
- (0, statistics_1.initFileProvider)(options['output-dir']);
42
- function compressFolder(folder, target) {
43
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
44
- (0, tar_1.create)({
45
- gzip: true,
46
- file: target,
47
- portable: true,
48
- preservePaths: false
49
- }, [folder]).then(() => {
50
- // now, remove the folder
51
- fs_1.default.rmSync(folder, { recursive: true, force: true });
52
- }, () => {
53
- console.log(`failed to compress ${folder}`);
54
- });
55
- }
56
- async function getStatsForSingleFile() {
57
- await shell.obtainTmpDir();
58
- const stats = await (0, statistics_1.extractUsageStatistics)(shell, () => { }, processedFeatures, (0, statistics_1.staticRequests)({ request: 'file', content: options.input }), options['root-dir']);
59
- // console.warn(`skipped ${stats.meta.failedRequests.length} requests due to errors (run with logs to get more info)`)
60
- if (stats.outputs.size === 1) {
61
- if (options['dump-json']) {
62
- const [, output] = [...stats.outputs.entries()][0];
63
- const cfg = (0, cfg_1.extractCFG)(output.normalize);
64
- statistics_1.statisticsFileProvider.append('output-json', 'parse', await (0, core_1.printStepResult)('parse', output.parse, 2 /* StepOutputFormat.Json */));
65
- statistics_1.statisticsFileProvider.append('output-json', 'normalize', await (0, core_1.printStepResult)('normalize', output.normalize, 2 /* StepOutputFormat.Json */));
66
- statistics_1.statisticsFileProvider.append('output-json', 'dataflow', await (0, core_1.printStepResult)('dataflow', output.dataflow, 2 /* StepOutputFormat.Json */));
67
- statistics_1.statisticsFileProvider.append('output-json', 'cfg', JSON.stringify(cfg, json_1.jsonReplacer));
68
- }
69
- statistics_1.statisticsFileProvider.append('meta', 'stats', JSON.stringify({ ...stats.meta, file: options.input }, json_1.jsonReplacer));
70
- statistics_1.statisticsFileProvider.append('meta', 'features', JSON.stringify(stats.features, json_1.jsonReplacer));
71
- }
72
- else {
73
- log_1.log.error(`expected exactly one output vs. ${stats.outputs.size}, got: ${JSON.stringify([...stats.outputs.keys()], json_1.jsonReplacer, 2)}`);
74
- }
75
- if (options.compress) {
76
- (0, assert_1.guard)(target !== undefined, 'target must be defined given the compress option');
77
- console.log(`[${(0, time_1.date2string)(new Date())}] Compressing ${options['output-dir']} to ${target}`);
78
- compressFolder(options['output-dir'], target);
79
- }
80
- shell.close();
81
- }
82
- void getStatsForSingleFile();
83
- //# sourceMappingURL=statistics-helper-app.js.map
@@ -1,18 +0,0 @@
1
- /**
2
- * The summarizer intends to post-process and summarize the results of
3
- * * the benchmark tool, and
4
- * * the statistics extraction.
5
- *
6
- * @module
7
- */
8
- export interface SummarizerCliOptions {
9
- verbose: boolean;
10
- help: boolean;
11
- 'ultimate-only': boolean;
12
- categorize: boolean;
13
- input: string;
14
- type: string;
15
- output?: string;
16
- graph?: boolean;
17
- 'project-skip': number;
18
- }
@@ -1,67 +0,0 @@
1
- "use strict";
2
- /**
3
- * The summarizer intends to post-process and summarize the results of
4
- * * the benchmark tool, and
5
- * * the statistics extraction.
6
- *
7
- * @module
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- const common_1 = require("./common");
11
- const summarizer_1 = require("../util/summarizer/benchmark/summarizer");
12
- const auto_detect_1 = require("../util/summarizer/auto-detect");
13
- const summarizer_2 = require("../util/summarizer/statistics/summarizer");
14
- const statistics_1 = require("../statistics");
15
- const options = (0, common_1.processCommandLineArgs)('summarizer', ['input'], {
16
- subtitle: 'Summarize and explain the results of the benchmark tool. Summarizes in two stages: first per-request, and then overall',
17
- examples: [
18
- '{italic benchmark.json}',
19
- '{bold --help}'
20
- ]
21
- });
22
- const outputBase = (options.output ?? options.input).replace(/\.json$|\/$/, '-summary');
23
- console.log(`Writing outputs to base ${outputBase}`);
24
- function getBenchmarkSummarizer() {
25
- return new summarizer_1.BenchmarkSummarizer({
26
- graphOutputPath: options.graph ? `${outputBase}-graph.json` : undefined,
27
- inputPath: options.input,
28
- intermediateOutputPath: `${outputBase}.json`,
29
- outputPath: `${outputBase}-ultimate.json`,
30
- outputLogPath: `${outputBase}.log`,
31
- logger: console.log
32
- });
33
- }
34
- function getStatisticsSummarizer() {
35
- return new summarizer_2.StatisticsSummarizer({
36
- inputPath: options.input,
37
- outputPath: `${outputBase}-final`,
38
- intermediateOutputPath: `${outputBase}-intermediate/`,
39
- projectSkip: options['project-skip'],
40
- featuresToUse: statistics_1.allFeatureNames,
41
- logger: console.log
42
- });
43
- }
44
- async function retrieveSummarizer() {
45
- const type = options.type === 'auto' ? await (0, auto_detect_1.detectSummarizationType)(options.input) : options.type;
46
- if (type === "benchmark" /* SummarizerType.Benchmark */) {
47
- console.log('Summarizing benchmark');
48
- return getBenchmarkSummarizer();
49
- }
50
- else if (type === "statistics" /* SummarizerType.Statistics */) {
51
- console.log('Summarizing statistics');
52
- return getStatisticsSummarizer();
53
- }
54
- else {
55
- console.error('Unknown type', type, 'either give "benchmark" or "statistics"');
56
- process.exit(1);
57
- }
58
- }
59
- async function run() {
60
- const summarizer = await retrieveSummarizer();
61
- if (!options['ultimate-only']) {
62
- await summarizer.preparationPhase(options.categorize);
63
- }
64
- await summarizer.summarizePhase();
65
- }
66
- void run();
67
- //# sourceMappingURL=summarizer-app.js.map
package/flowr.d.ts DELETED
@@ -1,27 +0,0 @@
1
- import type { OptionDefinition } from 'command-line-usage';
2
- export declare const toolName = "flowr";
3
- export declare const optionDefinitions: OptionDefinition[];
4
- export interface FlowrCliOptions {
5
- verbose: boolean;
6
- version: boolean;
7
- help: boolean;
8
- server: boolean;
9
- ws: boolean;
10
- port: number;
11
- 'no-ansi': boolean;
12
- execute: string | undefined;
13
- script: string | undefined;
14
- }
15
- export declare const optionHelp: ({
16
- header: string;
17
- content: string;
18
- optionList?: undefined;
19
- } | {
20
- header: string;
21
- content: string[];
22
- optionList?: undefined;
23
- } | {
24
- header: string;
25
- optionList: OptionDefinition[];
26
- content?: undefined;
27
- })[];
package/flowr.js DELETED
@@ -1,137 +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.optionHelp = exports.optionDefinitions = exports.toolName = void 0;
7
- /**
8
- * The main script to run flowR.
9
- *
10
- * If started with arguments it may be used to run a single of the flowR scripts.
11
- * Otherwise, it will start a REPL that can call these scripts and return their results repeatedly.
12
- */
13
- const log_1 = require("./util/log");
14
- const r_bridge_1 = require("./r-bridge");
15
- const command_line_usage_1 = __importDefault(require("command-line-usage"));
16
- const command_line_args_1 = __importDefault(require("command-line-args"));
17
- const assert_1 = require("./util/assert");
18
- const statistics_1 = require("./statistics");
19
- const repl_1 = require("./cli/repl");
20
- const common_1 = require("./cli/common");
21
- const package_json_1 = require("../package.json");
22
- const version_1 = require("./cli/repl/commands/version");
23
- const server_1 = require("./cli/repl/server/server");
24
- const commands_1 = require("./cli/repl/commands");
25
- const net_1 = require("./cli/repl/server/net");
26
- const scriptsText = Array.from(Object.entries(common_1.scripts).filter(([, { type }]) => type === 'master script'), ([k,]) => k).join(', ');
27
- exports.toolName = 'flowr';
28
- exports.optionDefinitions = [
29
- { name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging (will be passed to the corresponding script)' },
30
- { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide (or the guide of the corresponding script)' },
31
- { name: 'version', alias: 'V', type: Boolean, description: 'Provide information about the version of flowR as well as its underlying R system and exit.' },
32
- { name: 'server', type: Boolean, description: 'Do not drop into a repl, but instead start a server on the given port (default: 1042) and listen for messages.' },
33
- { name: 'ws', type: Boolean, description: 'If the server flag is set, use websocket for messaging' },
34
- { name: 'port', type: Number, description: 'The port to listen on, if --server is given.', defaultValue: 1042, typeLabel: '{underline port}' },
35
- { name: 'execute', alias: 'e', type: String, description: 'Execute the given command and exit. Use a semicolon ";" to separate multiple commands.', typeLabel: '{underline command}', multiple: false },
36
- { name: 'no-ansi', type: Boolean, description: 'Disable ansi-escape-sequences in the output. Useful, if you want to redirect the output to a file.' },
37
- { name: 'script', alias: 's', type: String, description: `The sub-script to run (${scriptsText})`, multiple: false, defaultOption: true, typeLabel: '{underline files}', defaultValue: undefined },
38
- ];
39
- exports.optionHelp = [
40
- {
41
- header: `flowR (version ${String(package_json_1.version)})`,
42
- content: 'A static dataflow analyzer and program slicer for R programs'
43
- },
44
- {
45
- header: 'Synopsis',
46
- content: [
47
- `$ ${exports.toolName} {bold --help}`,
48
- `$ ${exports.toolName} {bold --version}`,
49
- `$ ${exports.toolName} {bold --server}`,
50
- `$ ${exports.toolName} {bold --execute} {italic ":parse 2 - 4"}`,
51
- `$ ${exports.toolName} {bold slicer} {bold --help}`,
52
- ]
53
- },
54
- {
55
- header: 'Options',
56
- optionList: exports.optionDefinitions
57
- }
58
- ];
59
- const options = (0, command_line_args_1.default)(exports.optionDefinitions);
60
- log_1.log.updateSettings(l => l.settings.minLevel = options.verbose ? 1 /* LogLevel.Trace */ : 5 /* LogLevel.Error */);
61
- log_1.log.info('running with options', options);
62
- if (options['no-ansi']) {
63
- log_1.log.info('disabling ansi colors');
64
- (0, statistics_1.setFormatter)(statistics_1.voidFormatter);
65
- }
66
- async function retrieveShell() {
67
- // we keep an active shell session to allow other parse investigations :)
68
- const shell = new r_bridge_1.RShell({
69
- revive: 'always',
70
- onRevive: (code, signal) => {
71
- const signalText = signal == null ? '' : ` and signal ${signal}`;
72
- console.log(statistics_1.formatter.format(`R process exited with code ${code}${signalText}. Restarting...`, { color: 5 /* Colors.Magenta */, effect: statistics_1.ColorEffect.Foreground }));
73
- console.log((0, statistics_1.italic)(`If you want to exit, press either Ctrl+C twice, or enter ${(0, statistics_1.bold)(':quit')}`));
74
- },
75
- });
76
- shell.tryToInjectHomeLibPath();
77
- await shell.ensurePackageInstalled('xmlparsedata', true);
78
- return shell;
79
- }
80
- async function mainRepl() {
81
- if (options.script) {
82
- let target = common_1.scripts[options.script].target;
83
- (0, assert_1.guard)(target !== undefined, `Unknown script ${options.script}, pick one of ${scriptsText}.`);
84
- console.log(`Running script '${statistics_1.formatter.format(options.script, { style: 1 /* FontStyles.Bold */ })}'`);
85
- target = `cli/${target}`;
86
- log_1.log.debug(`Script maps to "${target}"`);
87
- await (0, repl_1.waitOnScript)(`${__dirname}/${target}`, process.argv.slice(3), undefined, true);
88
- process.exit(0);
89
- }
90
- if (options.help) {
91
- console.log((0, command_line_usage_1.default)(exports.optionHelp));
92
- process.exit(0);
93
- }
94
- if (options.version) {
95
- await (0, version_1.printVersionInformation)(commands_1.standardReplOutput);
96
- process.exit(0);
97
- }
98
- const shell = await retrieveShell();
99
- const end = () => {
100
- if (options.execute === undefined) {
101
- console.log(`\n${(0, statistics_1.italic)('Exiting...')}`);
102
- }
103
- shell.close();
104
- process.exit(0);
105
- };
106
- // hook some handlers
107
- process.on('SIGINT', end);
108
- process.on('SIGTERM', end);
109
- if (options.execute) {
110
- await (0, repl_1.replProcessAnswer)(commands_1.standardReplOutput, options.execute, shell);
111
- }
112
- else {
113
- await (0, repl_1.repl)(shell);
114
- }
115
- process.exit(0);
116
- }
117
- async function mainServer(backend = new net_1.NetServer()) {
118
- const shell = await retrieveShell();
119
- const end = () => {
120
- if (options.execute === undefined) {
121
- console.log(`\n${(0, statistics_1.italic)('Exiting...')}`);
122
- }
123
- shell.close();
124
- process.exit(0);
125
- };
126
- // hook some handlers
127
- process.on('SIGINT', end);
128
- process.on('SIGTERM', end);
129
- await new server_1.FlowRServer(shell, backend).start(options.port);
130
- }
131
- if (options.server) {
132
- void mainServer(options.ws ? new net_1.WebSocketServerWrapper() : new net_1.NetServer());
133
- }
134
- else {
135
- void mainRepl();
136
- }
137
- //# sourceMappingURL=flowr.js.map
@@ -1,25 +0,0 @@
1
- import type { MergeableRecord } from '../../../../../util/objects';
2
- import type { TokenMap } from '../../../../retriever';
3
- /**
4
- * Configures the settings for the xml parser (like what names should be used to represent the given objects,
5
- * and what replacements are active with `xmlparsedata` on the R-side of things).
6
- *
7
- * @see DEFAULT_XML_PARSER_CONFIG
8
- */
9
- export interface XmlParserConfig extends MergeableRecord {
10
- /** attributes (line, col, ...) are referenced by the given name */
11
- attributeName: string;
12
- /** the content (lexeme) is referenced by the given name */
13
- contentName: string;
14
- /** the children are referenced by the given name */
15
- childrenName: string;
16
- /** Mapping from xml tag name to the real operation of the node */
17
- tokenMap: TokenMap;
18
- }
19
- /**
20
- * Default configuration to be used for the {@link XmlParserConfig}.
21
- * <p>
22
- * Note, that this does not include a sensible {@link XmlParserConfig#tokenMap}, as this must be provided by the corresponding
23
- * shell environment.
24
- */
25
- export declare const DEFAULT_XML_PARSER_CONFIG: XmlParserConfig;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_XML_PARSER_CONFIG = void 0;
4
- /**
5
- * Default configuration to be used for the {@link XmlParserConfig}.
6
- * <p>
7
- * Note, that this does not include a sensible {@link XmlParserConfig#tokenMap}, as this must be provided by the corresponding
8
- * shell environment.
9
- */
10
- exports.DEFAULT_XML_PARSER_CONFIG = {
11
- attributeName: '@a',
12
- contentName: '@v',
13
- childrenName: '@c',
14
- tokenMap: { /* this should not be used, but just so that we can omit null-checks */}
15
- };
16
- //# sourceMappingURL=config.js.map
@@ -1,9 +0,0 @@
1
- import type { XmlParserConfig } from '../config';
2
- import type { XmlBasedJson } from '../input-format';
3
- /**
4
- * Parse the xml presented by R into a json object that will be used for conversion
5
- *
6
- * @param config - The configuration to use (i.e., what names should be used for the attributes, children, ...)
7
- * @param xmlString - The xml input to parse
8
- */
9
- export declare function xlm2jsonObject(config: XmlParserConfig, xmlString: string): Promise<XmlBasedJson>;
@@ -1,51 +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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.xlm2jsonObject = void 0;
27
- const xml2js = __importStar(require("xml2js"));
28
- /**
29
- * Parse the xml presented by R into a json object that will be used for conversion
30
- *
31
- * @param config - The configuration to use (i.e., what names should be used for the attributes, children, ...)
32
- * @param xmlString - The xml input to parse
33
- */
34
- function xlm2jsonObject(config, xmlString) {
35
- return xml2js.parseStringPromise(xmlString, {
36
- attrkey: config.attributeName,
37
- charkey: config.contentName,
38
- childkey: config.childrenName,
39
- charsAsChildren: false,
40
- explicitChildren: true,
41
- mergeAttrs: false,
42
- // we need this for semicolons etc., while we keep the old broken components we ignore them completely
43
- preserveChildrenOrder: true,
44
- trim: true,
45
- includeWhiteChars: true,
46
- normalize: false,
47
- strict: true
48
- });
49
- }
50
- exports.xlm2jsonObject = xlm2jsonObject;
51
- //# sourceMappingURL=xml-to-json.js.map
@@ -1,17 +0,0 @@
1
- import type { NormalizedAst, IdGenerator, NoInfo } from '../../model';
2
- import type { XmlParserHooks } from './hooks';
3
- import type { DeepPartial } from 'ts-essentials';
4
- import type { TokenMap } from '../../../../retriever';
5
- export declare const parseLog: import("tslog").Logger<import("tslog").ILogObj>;
6
- /**
7
- * The main entry point to normalize the given R ast.
8
- * You probably want to use {@link retrieveNormalizedAstFromRCode} to directly normalize a piece of code.
9
- *
10
- * @param xmlString - The XML string obtained probably by {@link retrieveXmlFromRCode} for normalization.
11
- * @param tokenMap - The token replacement map in effect by the XML parser
12
- * @param hooks - Optional hooks to customize the normalization process (see {@link XmlParserHooks} for details)
13
- * @param getId - The function to be used to generate unique ids for the nodes of the ast. It is up to you to ensure that the ids are unique!
14
- *
15
- * @returns The normalized and decorated AST (i.e., as a doubly linked tree)
16
- */
17
- export declare function normalize(xmlString: string, tokenMap: TokenMap, hooks?: DeepPartial<XmlParserHooks>, getId?: IdGenerator<NoInfo>): Promise<NormalizedAst>;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalize = exports.parseLog = void 0;
4
- const objects_1 = require("../../../../../util/objects");
5
- const log_1 = require("../../../../../util/log");
6
- const config_1 = require("./config");
7
- const internal_1 = require("./internal");
8
- const model_1 = require("../../model");
9
- const hooks_1 = require("./hooks");
10
- exports.parseLog = log_1.log.getSubLogger({ name: 'ast-parser' });
11
- /**
12
- * The main entry point to normalize the given R ast.
13
- * You probably want to use {@link retrieveNormalizedAstFromRCode} to directly normalize a piece of code.
14
- *
15
- * @param xmlString - The XML string obtained probably by {@link retrieveXmlFromRCode} for normalization.
16
- * @param tokenMap - The token replacement map in effect by the XML parser
17
- * @param hooks - Optional hooks to customize the normalization process (see {@link XmlParserHooks} for details)
18
- * @param getId - The function to be used to generate unique ids for the nodes of the ast. It is up to you to ensure that the ids are unique!
19
- *
20
- * @returns The normalized and decorated AST (i.e., as a doubly linked tree)
21
- */
22
- async function normalize(xmlString, tokenMap, hooks, getId = (0, model_1.deterministicCountingIdGenerator)(0)) {
23
- const config = { ...config_1.DEFAULT_XML_PARSER_CONFIG, tokenMap };
24
- const hooksWithDefaults = (0, objects_1.deepMergeObject)(hooks_1.DEFAULT_PARSER_HOOKS, hooks);
25
- const data = { config, hooks: hooksWithDefaults, currentRange: undefined, currentLexeme: undefined };
26
- const object = await (0, internal_1.xlm2jsonObject)(config, xmlString);
27
- return (0, model_1.decorateAst)((0, internal_1.parseRootObjToAst)(data, object), getId);
28
- }
29
- exports.normalize = normalize;
30
- //# sourceMappingURL=parser.js.map
@@ -1,31 +0,0 @@
1
- /**
2
- * Defines the type of syntax constructs that we track (e.g., true, false, 0, 1, T, F, conditions...)
3
- */
4
- import type { RNodeWithParent } from '../../r-bridge';
5
- import { RFalse, RTrue } from '../../r-bridge';
6
- import type { SummarizedMeasurement } from '../../util/summarizer/benchmark/data';
7
- export interface CommonSyntaxTypeCounts<Measurement = bigint> {
8
- total: Measurement;
9
- multiple: Measurement;
10
- empty: Measurement;
11
- withArgument: Measurement;
12
- noValue: Measurement;
13
- singleVar: Record<string, Measurement>;
14
- number: Record<number, Measurement>;
15
- integer: Record<number, Measurement>;
16
- complex: Record<number, Measurement>;
17
- string: Record<string, Measurement>;
18
- logical: Record<typeof RTrue | typeof RFalse, Measurement>;
19
- call: Record<string, Measurement>;
20
- unnamedCall: Measurement;
21
- binOp: Record<string, Measurement>;
22
- unaryOp: Record<string, Measurement>;
23
- other: Record<string, Measurement>;
24
- }
25
- export declare function emptyCommonSyntaxTypeCounts<T = bigint>(init?: () => T): CommonSyntaxTypeCounts<T>;
26
- /**
27
- * Updates the given counts based on the type of the given node.
28
- */
29
- export declare function updateCommonSyntaxTypeCounts(current: CommonSyntaxTypeCounts, ...nodes: RNodeWithParent[]): CommonSyntaxTypeCounts;
30
- export declare function appendCommonSyntaxTypeCounter(a: CommonSyntaxTypeCounts<number[][]>, b: CommonSyntaxTypeCounts): void;
31
- export declare function summarizeCommonSyntaxTypeCounter(a: CommonSyntaxTypeCounts<number[][]>): CommonSyntaxTypeCounts<SummarizedMeasurement>;