@eagleoutice/flowr 1.4.2 → 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 (223) hide show
  1. package/core/print/slice-diff-ansi.js +7 -7
  2. package/core/steps.d.ts +352 -11
  3. package/core/steps.js +4 -4
  4. package/index.d.ts +0 -2
  5. package/index.js +0 -2
  6. package/package.json +65 -215
  7. package/util/{summarizer/summarizer.d.ts → summarizer.d.ts} +15 -1
  8. package/util/summarizer.js +37 -0
  9. package/util/version.d.ts +2 -0
  10. package/util/version.js +10 -0
  11. package/benchmark/index.d.ts +0 -3
  12. package/benchmark/index.js +0 -20
  13. package/benchmark/slicer.d.ts +0 -98
  14. package/benchmark/slicer.js +0 -213
  15. package/benchmark/stats/index.d.ts +0 -10
  16. package/benchmark/stats/index.js +0 -27
  17. package/benchmark/stats/print.d.ts +0 -7
  18. package/benchmark/stats/print.js +0 -155
  19. package/benchmark/stats/stats.d.ts +0 -40
  20. package/benchmark/stats/stats.js +0 -6
  21. package/benchmark/stopwatch.d.ts +0 -35
  22. package/benchmark/stopwatch.js +0 -79
  23. package/cli/benchmark-app.d.ts +0 -10
  24. package/cli/benchmark-app.js +0 -67
  25. package/cli/benchmark-helper-app.d.ts +0 -9
  26. package/cli/benchmark-helper-app.js +0 -69
  27. package/cli/common/features.d.ts +0 -3
  28. package/cli/common/features.js +0 -30
  29. package/cli/common/index.d.ts +0 -2
  30. package/cli/common/index.js +0 -19
  31. package/cli/common/options.d.ts +0 -20
  32. package/cli/common/options.js +0 -85
  33. package/cli/common/script.d.ts +0 -21
  34. package/cli/common/script.js +0 -61
  35. package/cli/common/scripts-info.d.ts +0 -25
  36. package/cli/common/scripts-info.js +0 -83
  37. package/cli/export-quads-app.d.ts +0 -7
  38. package/cli/export-quads-app.js +0 -42
  39. package/cli/repl/commands/cfg.d.ts +0 -3
  40. package/cli/repl/commands/cfg.js +0 -37
  41. package/cli/repl/commands/commands.d.ts +0 -13
  42. package/cli/repl/commands/commands.js +0 -142
  43. package/cli/repl/commands/dataflow.d.ts +0 -3
  44. package/cli/repl/commands/dataflow.js +0 -34
  45. package/cli/repl/commands/execute.d.ts +0 -4
  46. package/cli/repl/commands/execute.js +0 -27
  47. package/cli/repl/commands/index.d.ts +0 -2
  48. package/cli/repl/commands/index.js +0 -19
  49. package/cli/repl/commands/main.d.ts +0 -39
  50. package/cli/repl/commands/main.js +0 -14
  51. package/cli/repl/commands/normalize.d.ts +0 -3
  52. package/cli/repl/commands/normalize.js +0 -34
  53. package/cli/repl/commands/parse.d.ts +0 -2
  54. package/cli/repl/commands/parse.js +0 -109
  55. package/cli/repl/commands/quit.d.ts +0 -2
  56. package/cli/repl/commands/quit.js +0 -15
  57. package/cli/repl/commands/version.d.ts +0 -16
  58. package/cli/repl/commands/version.js +0 -33
  59. package/cli/repl/core.d.ts +0 -41
  60. package/cli/repl/core.js +0 -172
  61. package/cli/repl/execute.d.ts +0 -28
  62. package/cli/repl/execute.js +0 -79
  63. package/cli/repl/index.d.ts +0 -5
  64. package/cli/repl/index.js +0 -22
  65. package/cli/repl/prompt.d.ts +0 -2
  66. package/cli/repl/prompt.js +0 -9
  67. package/cli/repl/server/connection.d.ts +0 -21
  68. package/cli/repl/server/connection.js +0 -213
  69. package/cli/repl/server/messages/analysis.d.ts +0 -71
  70. package/cli/repl/server/messages/analysis.js +0 -21
  71. package/cli/repl/server/messages/error.d.ts +0 -11
  72. package/cli/repl/server/messages/error.js +0 -3
  73. package/cli/repl/server/messages/hello.d.ts +0 -20
  74. package/cli/repl/server/messages/hello.js +0 -3
  75. package/cli/repl/server/messages/index.d.ts +0 -1
  76. package/cli/repl/server/messages/index.js +0 -3
  77. package/cli/repl/server/messages/messages.d.ts +0 -35
  78. package/cli/repl/server/messages/messages.js +0 -40
  79. package/cli/repl/server/messages/repl.d.ts +0 -33
  80. package/cli/repl/server/messages/repl.js +0 -37
  81. package/cli/repl/server/messages/slice.d.ts +0 -25
  82. package/cli/repl/server/messages/slice.js +0 -37
  83. package/cli/repl/server/net.d.ts +0 -49
  84. package/cli/repl/server/net.js +0 -63
  85. package/cli/repl/server/send.d.ts +0 -4
  86. package/cli/repl/server/send.js +0 -18
  87. package/cli/repl/server/server.d.ts +0 -20
  88. package/cli/repl/server/server.js +0 -66
  89. package/cli/repl/server/validate.d.ts +0 -15
  90. package/cli/repl/server/validate.js +0 -34
  91. package/cli/slicer-app.d.ts +0 -11
  92. package/cli/slicer-app.js +0 -81
  93. package/cli/statistics-app.d.ts +0 -11
  94. package/cli/statistics-app.js +0 -98
  95. package/cli/statistics-helper-app.d.ts +0 -11
  96. package/cli/statistics-helper-app.js +0 -82
  97. package/cli/summarizer-app.d.ts +0 -18
  98. package/cli/summarizer-app.js +0 -66
  99. package/flowr.d.ts +0 -29
  100. package/flowr.js +0 -142
  101. package/statistics/features/common-syntax-probability.d.ts +0 -31
  102. package/statistics/features/common-syntax-probability.js +0 -156
  103. package/statistics/features/feature.d.ts +0 -175
  104. package/statistics/features/feature.js +0 -30
  105. package/statistics/features/index.d.ts +0 -1
  106. package/statistics/features/index.js +0 -18
  107. package/statistics/features/post-processing.d.ts +0 -12
  108. package/statistics/features/post-processing.js +0 -21
  109. package/statistics/features/supported/assignments/assignments.d.ts +0 -11
  110. package/statistics/features/supported/assignments/assignments.js +0 -53
  111. package/statistics/features/supported/assignments/index.d.ts +0 -1
  112. package/statistics/features/supported/assignments/index.js +0 -6
  113. package/statistics/features/supported/assignments/post-process.d.ts +0 -3
  114. package/statistics/features/supported/assignments/post-process.js +0 -125
  115. package/statistics/features/supported/comments/comments.d.ts +0 -18
  116. package/statistics/features/supported/comments/comments.js +0 -133
  117. package/statistics/features/supported/comments/index.d.ts +0 -1
  118. package/statistics/features/supported/comments/index.js +0 -6
  119. package/statistics/features/supported/comments/post-process.d.ts +0 -3
  120. package/statistics/features/supported/comments/post-process.js +0 -50
  121. package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
  122. package/statistics/features/supported/control-flow/control-flow.js +0 -67
  123. package/statistics/features/supported/control-flow/index.d.ts +0 -1
  124. package/statistics/features/supported/control-flow/index.js +0 -6
  125. package/statistics/features/supported/control-flow/post-process.d.ts +0 -3
  126. package/statistics/features/supported/control-flow/post-process.js +0 -65
  127. package/statistics/features/supported/data-access/data-access.d.ts +0 -15
  128. package/statistics/features/supported/data-access/data-access.js +0 -118
  129. package/statistics/features/supported/data-access/index.d.ts +0 -1
  130. package/statistics/features/supported/data-access/index.js +0 -6
  131. package/statistics/features/supported/data-access/post-process.d.ts +0 -3
  132. package/statistics/features/supported/data-access/post-process.js +0 -107
  133. package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -35
  134. package/statistics/features/supported/defined-functions/defined-functions.js +0 -139
  135. package/statistics/features/supported/defined-functions/index.d.ts +0 -1
  136. package/statistics/features/supported/defined-functions/index.js +0 -6
  137. package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
  138. package/statistics/features/supported/defined-functions/post-process.js +0 -177
  139. package/statistics/features/supported/expression-list/expression-list.d.ts +0 -9
  140. package/statistics/features/supported/expression-list/expression-list.js +0 -36
  141. package/statistics/features/supported/expression-list/index.d.ts +0 -1
  142. package/statistics/features/supported/expression-list/index.js +0 -6
  143. package/statistics/features/supported/expression-list/post-process.d.ts +0 -3
  144. package/statistics/features/supported/expression-list/post-process.js +0 -44
  145. package/statistics/features/supported/index.d.ts +0 -10
  146. package/statistics/features/supported/index.js +0 -27
  147. package/statistics/features/supported/loops/index.d.ts +0 -1
  148. package/statistics/features/supported/loops/index.js +0 -6
  149. package/statistics/features/supported/loops/loops.d.ts +0 -20
  150. package/statistics/features/supported/loops/loops.js +0 -79
  151. package/statistics/features/supported/loops/post-process.d.ts +0 -3
  152. package/statistics/features/supported/loops/post-process.js +0 -72
  153. package/statistics/features/supported/used-functions/index.d.ts +0 -1
  154. package/statistics/features/supported/used-functions/index.js +0 -6
  155. package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
  156. package/statistics/features/supported/used-functions/post-process.js +0 -179
  157. package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
  158. package/statistics/features/supported/used-functions/used-functions.js +0 -95
  159. package/statistics/features/supported/used-packages/index.d.ts +0 -1
  160. package/statistics/features/supported/used-packages/index.js +0 -6
  161. package/statistics/features/supported/used-packages/post-process.d.ts +0 -3
  162. package/statistics/features/supported/used-packages/post-process.js +0 -121
  163. package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
  164. package/statistics/features/supported/used-packages/used-packages.js +0 -130
  165. package/statistics/features/supported/values/index.d.ts +0 -1
  166. package/statistics/features/supported/values/index.js +0 -6
  167. package/statistics/features/supported/values/post-process.d.ts +0 -3
  168. package/statistics/features/supported/values/post-process.js +0 -72
  169. package/statistics/features/supported/values/values.d.ts +0 -14
  170. package/statistics/features/supported/values/values.js +0 -101
  171. package/statistics/features/supported/variables/index.d.ts +0 -1
  172. package/statistics/features/supported/variables/index.js +0 -6
  173. package/statistics/features/supported/variables/post-process.d.ts +0 -9
  174. package/statistics/features/supported/variables/post-process.js +0 -122
  175. package/statistics/features/supported/variables/variables.d.ts +0 -15
  176. package/statistics/features/supported/variables/variables.js +0 -70
  177. package/statistics/index.d.ts +0 -6
  178. package/statistics/index.js +0 -24
  179. package/statistics/meta-statistics.d.ts +0 -33
  180. package/statistics/meta-statistics.js +0 -17
  181. package/statistics/output/file-provider.d.ts +0 -37
  182. package/statistics/output/file-provider.js +0 -97
  183. package/statistics/output/index.d.ts +0 -4
  184. package/statistics/output/index.js +0 -21
  185. package/statistics/output/print-stats.d.ts +0 -17
  186. package/statistics/output/print-stats.js +0 -69
  187. package/statistics/output/statistics-file.d.ts +0 -37
  188. package/statistics/output/statistics-file.js +0 -69
  189. package/statistics/statistics.d.ts +0 -24
  190. package/statistics/statistics.js +0 -108
  191. package/util/summarizer/auto-detect.d.ts +0 -2
  192. package/util/summarizer/auto-detect.js +0 -32
  193. package/util/summarizer/benchmark/data.d.ts +0 -66
  194. package/util/summarizer/benchmark/data.js +0 -13
  195. package/util/summarizer/benchmark/first-phase/input.d.ts +0 -3
  196. package/util/summarizer/benchmark/first-phase/input.js +0 -75
  197. package/util/summarizer/benchmark/first-phase/process.d.ts +0 -11
  198. package/util/summarizer/benchmark/first-phase/process.js +0 -217
  199. package/util/summarizer/benchmark/second-phase/graph.d.ts +0 -2
  200. package/util/summarizer/benchmark/second-phase/graph.js +0 -54
  201. package/util/summarizer/benchmark/second-phase/process.d.ts +0 -6
  202. package/util/summarizer/benchmark/second-phase/process.js +0 -126
  203. package/util/summarizer/benchmark/summarizer.d.ts +0 -31
  204. package/util/summarizer/benchmark/summarizer.js +0 -58
  205. package/util/summarizer/statistics/first-phase/process.d.ts +0 -6
  206. package/util/summarizer/statistics/first-phase/process.js +0 -81
  207. package/util/summarizer/statistics/post-process/clusterer.d.ts +0 -26
  208. package/util/summarizer/statistics/post-process/clusterer.js +0 -43
  209. package/util/summarizer/statistics/post-process/file-based-count.d.ts +0 -17
  210. package/util/summarizer/statistics/post-process/file-based-count.js +0 -49
  211. package/util/summarizer/statistics/post-process/histogram.d.ts +0 -59
  212. package/util/summarizer/statistics/post-process/histogram.js +0 -128
  213. package/util/summarizer/statistics/post-process/index.d.ts +0 -4
  214. package/util/summarizer/statistics/post-process/index.js +0 -21
  215. package/util/summarizer/statistics/post-process/post-process-output.d.ts +0 -16
  216. package/util/summarizer/statistics/post-process/post-process-output.js +0 -103
  217. package/util/summarizer/statistics/second-phase/process.d.ts +0 -11
  218. package/util/summarizer/statistics/second-phase/process.js +0 -117
  219. package/util/summarizer/statistics/summarizer.d.ts +0 -35
  220. package/util/summarizer/statistics/summarizer.js +0 -135
  221. package/util/summarizer/summarizer.js +0 -13
  222. /package/{statistics/output → util}/ansi.d.ts +0 -0
  223. /package/{statistics/output → util}/ansi.js +0 -0
@@ -1,9 +0,0 @@
1
- export interface SingleBenchmarkCliOptions {
2
- verbose: boolean;
3
- help: boolean;
4
- input?: string;
5
- 'file-id'?: number;
6
- 'run-num'?: number;
7
- slice: string;
8
- output?: string;
9
- }
@@ -1,69 +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
- (0, assert_1.guard)((options['file-id'] === undefined) === (options['run-num'] === undefined), 'When giving a file-id or run-num, both have to be given');
29
- // prefix for printing to console, includes file id and run number if present
30
- const prefix = `[${options.input}${options['file-id'] !== undefined ? ` (file ${options['file-id']}, run ${options['run-num']})` : ''}]`;
31
- console.log(`${prefix} Appending output to ${options.output}`);
32
- // ensure the file exists
33
- const fileStat = fs_1.default.statSync(options.input);
34
- (0, assert_1.guard)(fileStat.isFile(), `File ${options.input} does not exist or is no file`);
35
- const request = { request: 'file', content: options.input };
36
- const slicer = new benchmark_1.BenchmarkSlicer();
37
- try {
38
- await slicer.init(request);
39
- // ${escape}1F${escape}1G${escape}2K for line reset
40
- if (options.slice === 'all') {
41
- const count = await slicer.sliceForAll(slicing_1.DefaultAllVariablesFilter, (i, total, arr) => console.log(`${prefix} Slicing ${i + 1}/${total} [${JSON.stringify(arr[i])}]`));
42
- console.log(`${prefix} Completed Slicing`);
43
- (0, assert_1.guard)(count > 0, `No possible slices found for ${options.input}, skipping in count`);
44
- }
45
- else {
46
- console.log(`${prefix} Skipping Slicing due to --slice=${options.slice}`);
47
- }
48
- const { stats } = slicer.finish();
49
- const output = {
50
- filename: options.input,
51
- 'file-id': options['file-id'],
52
- 'run-num': options['run-num'],
53
- stats
54
- };
55
- // append line by line
56
- fs_1.default.appendFileSync(options.output, `${JSON.stringify(output, json_1.jsonReplacer)}\n`);
57
- }
58
- catch (e) {
59
- if (e instanceof Error) {
60
- if (!e.message.includes('unable to parse R')) {
61
- console.log(`${prefix} Non R-Side error : ${e.message}`);
62
- }
63
- }
64
- slicer.ensureSessionClosed(); // ensure finish
65
- throw e;
66
- }
67
- }
68
- void benchmark();
69
- //# 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,85 +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: 'runs', alias: 'r', type: Number, description: 'The amount of benchmark runs that should be done, out of which an average will be calculated' },
19
- { 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}' },
20
- { 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}' },
21
- { 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}' },
22
- { name: 'output', alias: 'o', type: String, description: `Directory to write all the measurements to in a per-file-basis (defaults to {italic benchmark-${StartTimeString}})`, defaultValue: `benchmark-${StartTimeString}`, typeLabel: '{underline file}' }
23
- ];
24
- exports.benchmarkHelperOptions = [
25
- { 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]' },
26
- { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
27
- { name: 'input', alias: 'i', type: String, description: 'Pass a single file as src to read from', multiple: false, defaultOption: true, typeLabel: '{underline file}' },
28
- { name: 'file-id', alias: 'd', type: Number, description: 'A numeric file id that can be used to match an input and run-num to a file' },
29
- { name: 'run-num', alias: 'r', type: Number, description: 'The n-th time that the file with the given file-id is being benchmarked' },
30
- { 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}' },
31
- { name: 'output', alias: 'o', type: String, description: 'File to write the measurements to (appends a single line in JSON format)', typeLabel: '{underline file}' },
32
- ];
33
- exports.exportQuadsOptions = [
34
- { name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging' },
35
- { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
36
- { 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}' },
37
- { name: 'limit', alias: 'l', type: Number, description: 'Limit the number of files to process' },
38
- { name: 'output', alias: 'o', type: String, description: 'File to write all the generated quads to (defaults to {italic out.quads})', typeLabel: '{underline file}' },
39
- ];
40
- exports.slicerOptions = [
41
- { name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging' },
42
- { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
43
- { name: 'input', alias: 'i', type: String, description: '(Required) Pass a single file to slice', multiple: false, defaultOption: true, typeLabel: '{underline files}' },
44
- { name: 'input-is-text', alias: 'r', type: Boolean, description: 'Indicate, that the input is *not* a file, but R code to directly consume' },
45
- { 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.' },
46
- { 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 },
47
- { name: 'stats', alias: 's', type: Boolean, description: 'Print stats and write them to {italic <output>.stats} (runtimes etc.)', multiple: false },
48
- { name: 'output', alias: 'o', type: String, description: 'File to write all the generated quads to (defaults to the commandline)', typeLabel: '{underline file}' },
49
- { name: 'api', type: Boolean, description: 'Instead of human-readable output, dump a lot of json with the results of all intermediate steps.' },
50
- ];
51
- const featureNameList = [...statistics_1.allFeatureNames].map(s => `"${s}"`).join(', ');
52
- exports.statisticOptions = [
53
- { name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging' },
54
- { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
55
- { name: 'limit', alias: 'l', type: Number, description: 'Limit the number of files to process' },
56
- { 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}' },
57
- { 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}' },
58
- { name: 'dump-json', type: Boolean, description: 'Write JSON output during the extraction', typeLabel: '{underline folder}' },
59
- { name: 'no-ansi', type: Boolean, description: 'Disable ansi-escape-sequences in the output. Useful, if you want to redirect the output to a file.' },
60
- { 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}' },
61
- { name: 'features', type: String, description: `Features to track, supported are "all" or ${featureNameList}`, multiple: true, defaultValue: 'all', typeLabel: '{underline names}' },
62
- ];
63
- exports.statisticHelperOptions = [
64
- { name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging' },
65
- { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
66
- { name: 'input', alias: 'i', type: String, description: 'Pass single file as src to read from', multiple: false, defaultOption: true, typeLabel: '{underline file}' },
67
- { name: 'output-dir', alias: 'o', type: String, description: 'Folder to write the output to', typeLabel: '{underline folder}' },
68
- { name: 'root-dir', type: String, description: 'Root dir for the statistics files', defaultValue: '' },
69
- { name: 'compress', type: Boolean, description: 'Compress the output folder to a single file', defaultValue: false },
70
- { name: 'dump-json', type: Boolean, description: 'Write JSON output during the extraction', typeLabel: '{underline folder}' },
71
- { name: 'no-ansi', type: Boolean, description: 'Disable ansi-escape-sequences in the output. Useful, if you want to redirect the output to a file.' },
72
- { name: 'features', type: String, description: `Features to track, supported are "all" or ${featureNameList}`, multiple: true, defaultValue: 'all', typeLabel: '{underline names}' },
73
- ];
74
- exports.summarizerOptions = [
75
- { name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging' },
76
- { name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
77
- { 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' },
78
- { name: 'graph', alias: 'g', type: Boolean, description: 'Produce data to be used for visualizing benchmarks over time' },
79
- { name: 'categorize', type: Boolean, description: 'Categorize the results (e.g., "test", "example", ...)', defaultValue: false },
80
- { name: 'project-skip', type: Number, description: 'Skip the first n folders to find the location of projects', defaultValue: 0 },
81
- { 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.' },
82
- { 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}' },
83
- { name: 'output', alias: 'o', type: String, description: 'Basename of the summaries (defaults to {italic <input>-summary})', typeLabel: '{underline file}' },
84
- ];
85
- //# 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,25 +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 declare function getValidOptionsForCompletion(options: readonly OptionDefinition[], prevArgs: readonly string[]): string[];
25
- export {};
@@ -1,83 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getValidOptionsForCompletion = exports.scripts = void 0;
4
- const options_1 = require("./options");
5
- const commands_1 = require("../repl/commands");
6
- /**
7
- * We hold `_scripts` internally, as the modifiable variant and export the readonly scripts
8
- */
9
- const _scripts = {
10
- 'slicer': {
11
- toolName: 'slicer',
12
- target: 'slicer-app',
13
- description: 'Static backwards executable slicer for R',
14
- options: options_1.slicerOptions,
15
- usageExample: 'slicer -c "12@product" test/testfiles/example.R',
16
- type: 'master script',
17
- },
18
- 'benchmark': {
19
- toolName: 'benchmark',
20
- target: 'benchmark-app',
21
- description: 'Benchmark the static backwards slicer',
22
- type: 'master script',
23
- usageExample: 'benchmark "example-folder/"',
24
- options: options_1.benchmarkOptions
25
- },
26
- 'benchmark-helper': {
27
- toolName: 'benchmark-single',
28
- target: 'benchmark-helper-app',
29
- description: 'Helper Script to Benchmark the Slicer',
30
- usageExample: 'benchmark-single "example.R" --output "example.json"',
31
- options: options_1.benchmarkHelperOptions,
32
- type: 'helper script',
33
- masterScripts: ['benchmark']
34
- },
35
- 'summarizer': {
36
- toolName: 'summarizer',
37
- target: 'summarizer-app',
38
- description: 'Summarize the results of the benchmark',
39
- options: options_1.summarizerOptions,
40
- usageExample: 'summarizer "benchmark.json"',
41
- type: 'master script',
42
- },
43
- 'export-quads': {
44
- toolName: 'export-quads',
45
- target: 'export-quads-app',
46
- description: 'Export quads of the normalized AST of a given R code file',
47
- usageExample: 'export-quads "example.R" --output "example.quads"',
48
- options: options_1.exportQuadsOptions,
49
- type: 'master script',
50
- },
51
- 'stats': {
52
- toolName: 'stats',
53
- target: 'statistics-app',
54
- description: 'Generate usage Statistics for R scripts',
55
- options: options_1.statisticOptions,
56
- usageExample: 'stats -i example.R --output-dir "output-folder/"',
57
- type: 'master script',
58
- },
59
- 'stats-helper': {
60
- toolName: 'stats-helper',
61
- target: 'statistics-helper-app',
62
- description: 'Generate usage Statistics for a single R script (parallel helper for stats)',
63
- options: options_1.statisticHelperOptions,
64
- usageExample: 'stats-helper -i example.R --output-dir "output-folder/"',
65
- type: 'helper script',
66
- masterScripts: ['stats']
67
- }
68
- };
69
- exports.scripts = _scripts;
70
- function getValidOptionsForCompletion(options, prevArgs) {
71
- return options.filter(o => canAddOption(o, prevArgs)).flatMap(o => {
72
- const args = [(0, commands_1.asOptionName)(o.name)];
73
- if (o.alias) {
74
- args.push((0, commands_1.asOptionName)(o.alias));
75
- }
76
- return args;
77
- });
78
- }
79
- exports.getValidOptionsForCompletion = getValidOptionsForCompletion;
80
- function canAddOption(option, prevArgs) {
81
- return option.multiple || !prevArgs.includes((0, commands_1.asOptionName)(option.name)) && (!option.alias || !prevArgs.includes((0, commands_1.asOptionName)(option.alias)));
82
- }
83
- //# 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,42 +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
- async function writeQuadForSingleFile(request, output) {
21
- const normalized = await (0, r_bridge_1.retrieveNormalizedAstFromRCode)(request, shell);
22
- const serialized = (0, quads_1.serialize2quads)(normalized.ast, { context: request.content });
23
- log_1.log.info(`Appending quads to ${output}`);
24
- fs_1.default.appendFileSync(output, serialized);
25
- }
26
- async function getQuads() {
27
- const output = options.output ?? 'out.quads';
28
- let skipped = 0;
29
- for await (const request of (0, files_1.allRFilesFrom)(options.input, options.limit)) {
30
- try {
31
- await writeQuadForSingleFile(request, output);
32
- }
33
- catch (e) {
34
- log_1.log.error(`[Skipped] Error while processing ${request.content}: ${e.message} (${e.stack ?? ''})`);
35
- skipped++;
36
- }
37
- }
38
- console.log(`Skipped ${skipped} files`);
39
- shell.close();
40
- }
41
- void getQuads();
42
- //# 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;
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.controlflowStarCommand = exports.controlflowCommand = void 0;
4
- const core_1 = require("../../../core");
5
- const r_bridge_1 = require("../../../r-bridge");
6
- const cfg_1 = require("../../../util/cfg/cfg");
7
- const mermaid_1 = require("../../../util/mermaid");
8
- async function controlflow(shell, remainingLine) {
9
- return await new core_1.SteppingSlicer({
10
- stepOfInterest: 'normalize',
11
- shell,
12
- request: (0, r_bridge_1.requestFromInput)(remainingLine.trim())
13
- }).allRemainingSteps();
14
- }
15
- exports.controlflowCommand = {
16
- description: `Get mermaid code for the control-flow graph of R code, start with '${r_bridge_1.fileProtocol}' to indicate a file`,
17
- usageExample: ':controlflow',
18
- aliases: ['cfg', 'cf'],
19
- script: false,
20
- fn: async (output, shell, remainingLine) => {
21
- const result = await controlflow(shell, remainingLine);
22
- const cfg = (0, cfg_1.extractCFG)(result.normalize);
23
- output.stdout((0, mermaid_1.cfgToMermaid)(cfg, result.normalize));
24
- }
25
- };
26
- exports.controlflowStarCommand = {
27
- description: `Get a mermaid url of the control-flow graph of R code, start with '${r_bridge_1.fileProtocol}' to indicate a file`,
28
- usageExample: ':controlflow',
29
- aliases: ['cfg*', 'cf*'],
30
- script: false,
31
- fn: async (output, shell, remainingLine) => {
32
- const result = await controlflow(shell, remainingLine);
33
- const cfg = (0, cfg_1.extractCFG)(result.normalize);
34
- output.stdout((0, mermaid_1.cfgToMermaidUrl)(cfg, result.normalize));
35
- }
36
- };
37
- //# sourceMappingURL=cfg.js.map
@@ -1,13 +0,0 @@
1
- import type { ReplCommand } from './main';
2
- export declare const helpCommand: ReplCommand;
3
- /**
4
- * The names of all commands including their aliases (but without the leading `:`)
5
- */
6
- export declare function getCommandNames(): string[];
7
- /**
8
- * Get the command for a given command name or alias.
9
- * @param command - The name of the command (without the leading `:`)
10
- */
11
- export declare function getCommand(command: string): ReplCommand | undefined;
12
- export declare function asOptionName(argument: string): string;
13
- export declare function longestCommandName(): number;