@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.
- package/README.md +3 -3
- package/abstract-interpretation/processor.js +9 -3
- package/config.d.ts +16 -0
- package/config.js +75 -0
- package/core/input.d.ts +1 -1
- package/core/output.d.ts +1 -2
- package/core/print/parse-printer.d.ts +1 -2
- package/core/print/parse-printer.js +6 -4
- package/core/print/slice-diff-ansi.js +7 -7
- package/core/slicer.js +4 -8
- package/core/steps.d.ts +355 -31
- package/core/steps.js +7 -14
- package/dataflow/environments/environment.js +8 -0
- package/dataflow/environments/register.js +1 -0
- package/dataflow/extractor.d.ts +2 -2
- package/dataflow/extractor.js +10 -2
- package/dataflow/internal/process/functions/function-call.js +7 -1
- package/dataflow/internal/process/functions/source.d.ts +8 -0
- package/dataflow/internal/process/functions/source.js +81 -0
- package/dataflow/processor.d.ts +10 -1
- package/index.d.ts +0 -2
- package/index.js +0 -2
- package/package.json +75 -202
- package/r-bridge/lang-4.x/ast/index.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/index.js +3 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +6 -1
- package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +14 -0
- package/r-bridge/lang-4.x/ast/parser/json/format.js +26 -0
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +7 -0
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +57 -0
- package/r-bridge/lang-4.x/ast/parser/xml/data.d.ts +0 -3
- package/r-bridge/lang-4.x/ast/parser/xml/index.d.ts +0 -2
- package/r-bridge/lang-4.x/ast/parser/xml/index.js +0 -2
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.d.ts +5 -1
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +7 -10
- package/r-bridge/lang-4.x/ast/parser/xml/internal/access.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then-else.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/argument.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/call.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/definition.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/parameter.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/index.d.ts +0 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/index.js +0 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/break.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/for.js +3 -6
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/next.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/repeat.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/while.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.d.ts +6 -11
- package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.js +15 -23
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/binary.js +6 -6
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/comment.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/line-directive.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.js +3 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/number.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/string.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/symbol.js +4 -4
- package/r-bridge/lang-4.x/values.d.ts +0 -1
- package/r-bridge/lang-4.x/values.js +14 -6
- package/r-bridge/retriever.d.ts +25 -21
- package/r-bridge/retriever.js +73 -23
- package/r-bridge/shell-executor.d.ts +3 -17
- package/r-bridge/shell-executor.js +9 -78
- package/r-bridge/shell.d.ts +5 -27
- package/r-bridge/shell.js +31 -92
- package/{statistics/output → util}/ansi.js +1 -1
- package/util/args.d.ts +8 -4
- package/util/args.js +11 -4
- package/util/cfg/visitor.js +1 -1
- package/util/files.d.ts +6 -0
- package/util/files.js +11 -1
- package/util/log.js +3 -0
- package/util/{summarizer/summarizer.d.ts → summarizer.d.ts} +15 -1
- package/util/summarizer.js +37 -0
- package/util/version.d.ts +2 -0
- package/util/version.js +10 -0
- package/benchmark/index.d.ts +0 -3
- package/benchmark/index.js +0 -20
- package/benchmark/slicer.d.ts +0 -101
- package/benchmark/slicer.js +0 -225
- package/benchmark/stats/index.d.ts +0 -10
- package/benchmark/stats/index.js +0 -27
- package/benchmark/stats/print.d.ts +0 -7
- package/benchmark/stats/print.js +0 -157
- package/benchmark/stats/stats.d.ts +0 -41
- package/benchmark/stats/stats.js +0 -6
- package/benchmark/stopwatch.d.ts +0 -35
- package/benchmark/stopwatch.js +0 -79
- package/cli/benchmark-app.d.ts +0 -9
- package/cli/benchmark-app.js +0 -52
- package/cli/benchmark-helper-app.d.ts +0 -7
- package/cli/benchmark-helper-app.js +0 -60
- package/cli/common/features.d.ts +0 -3
- package/cli/common/features.js +0 -30
- package/cli/common/index.d.ts +0 -2
- package/cli/common/index.js +0 -19
- package/cli/common/options.d.ts +0 -20
- package/cli/common/options.js +0 -82
- package/cli/common/script.d.ts +0 -21
- package/cli/common/script.js +0 -61
- package/cli/common/scripts-info.d.ts +0 -24
- package/cli/common/scripts-info.js +0 -69
- package/cli/export-quads-app.d.ts +0 -7
- package/cli/export-quads-app.js +0 -46
- package/cli/repl/commands/cfg.d.ts +0 -3
- package/cli/repl/commands/cfg.js +0 -37
- package/cli/repl/commands/commands.d.ts +0 -11
- package/cli/repl/commands/commands.js +0 -103
- package/cli/repl/commands/dataflow.d.ts +0 -3
- package/cli/repl/commands/dataflow.js +0 -34
- package/cli/repl/commands/execute.d.ts +0 -4
- package/cli/repl/commands/execute.js +0 -27
- package/cli/repl/commands/index.d.ts +0 -2
- package/cli/repl/commands/index.js +0 -19
- package/cli/repl/commands/main.d.ts +0 -39
- package/cli/repl/commands/main.js +0 -14
- package/cli/repl/commands/normalize.d.ts +0 -3
- package/cli/repl/commands/normalize.js +0 -34
- package/cli/repl/commands/parse.d.ts +0 -2
- package/cli/repl/commands/parse.js +0 -109
- package/cli/repl/commands/quit.d.ts +0 -2
- package/cli/repl/commands/quit.js +0 -12
- package/cli/repl/commands/version.d.ts +0 -16
- package/cli/repl/commands/version.js +0 -33
- package/cli/repl/core.d.ts +0 -39
- package/cli/repl/core.js +0 -116
- package/cli/repl/execute.d.ts +0 -28
- package/cli/repl/execute.js +0 -79
- package/cli/repl/index.d.ts +0 -5
- package/cli/repl/index.js +0 -22
- package/cli/repl/prompt.d.ts +0 -2
- package/cli/repl/prompt.js +0 -9
- package/cli/repl/server/connection.d.ts +0 -21
- package/cli/repl/server/connection.js +0 -218
- package/cli/repl/server/messages/analysis.d.ts +0 -71
- package/cli/repl/server/messages/analysis.js +0 -21
- package/cli/repl/server/messages/error.d.ts +0 -11
- package/cli/repl/server/messages/error.js +0 -3
- package/cli/repl/server/messages/hello.d.ts +0 -20
- package/cli/repl/server/messages/hello.js +0 -3
- package/cli/repl/server/messages/index.d.ts +0 -1
- package/cli/repl/server/messages/index.js +0 -3
- package/cli/repl/server/messages/messages.d.ts +0 -35
- package/cli/repl/server/messages/messages.js +0 -40
- package/cli/repl/server/messages/repl.d.ts +0 -33
- package/cli/repl/server/messages/repl.js +0 -37
- package/cli/repl/server/messages/slice.d.ts +0 -25
- package/cli/repl/server/messages/slice.js +0 -37
- package/cli/repl/server/net.d.ts +0 -49
- package/cli/repl/server/net.js +0 -63
- package/cli/repl/server/send.d.ts +0 -4
- package/cli/repl/server/send.js +0 -18
- package/cli/repl/server/server.d.ts +0 -20
- package/cli/repl/server/server.js +0 -66
- package/cli/repl/server/validate.d.ts +0 -15
- package/cli/repl/server/validate.js +0 -34
- package/cli/slicer-app.d.ts +0 -11
- package/cli/slicer-app.js +0 -81
- package/cli/statistics-app.d.ts +0 -11
- package/cli/statistics-app.js +0 -98
- package/cli/statistics-helper-app.d.ts +0 -11
- package/cli/statistics-helper-app.js +0 -83
- package/cli/summarizer-app.d.ts +0 -18
- package/cli/summarizer-app.js +0 -67
- package/flowr.d.ts +0 -27
- package/flowr.js +0 -137
- package/r-bridge/lang-4.x/ast/parser/xml/config.d.ts +0 -25
- package/r-bridge/lang-4.x/ast/parser/xml/config.js +0 -16
- package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.d.ts +0 -9
- package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.js +0 -51
- package/r-bridge/lang-4.x/ast/parser/xml/parser.d.ts +0 -17
- package/r-bridge/lang-4.x/ast/parser/xml/parser.js +0 -30
- package/statistics/features/common-syntax-probability.d.ts +0 -31
- package/statistics/features/common-syntax-probability.js +0 -156
- package/statistics/features/feature.d.ts +0 -175
- package/statistics/features/feature.js +0 -30
- package/statistics/features/index.d.ts +0 -1
- package/statistics/features/index.js +0 -18
- package/statistics/features/post-processing.d.ts +0 -12
- package/statistics/features/post-processing.js +0 -21
- package/statistics/features/supported/assignments/assignments.d.ts +0 -11
- package/statistics/features/supported/assignments/assignments.js +0 -53
- package/statistics/features/supported/assignments/index.d.ts +0 -1
- package/statistics/features/supported/assignments/index.js +0 -6
- package/statistics/features/supported/assignments/post-process.d.ts +0 -3
- package/statistics/features/supported/assignments/post-process.js +0 -125
- package/statistics/features/supported/comments/comments.d.ts +0 -18
- package/statistics/features/supported/comments/comments.js +0 -133
- package/statistics/features/supported/comments/index.d.ts +0 -1
- package/statistics/features/supported/comments/index.js +0 -6
- package/statistics/features/supported/comments/post-process.d.ts +0 -3
- package/statistics/features/supported/comments/post-process.js +0 -50
- package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
- package/statistics/features/supported/control-flow/control-flow.js +0 -67
- package/statistics/features/supported/control-flow/index.d.ts +0 -1
- package/statistics/features/supported/control-flow/index.js +0 -6
- package/statistics/features/supported/control-flow/post-process.d.ts +0 -3
- package/statistics/features/supported/control-flow/post-process.js +0 -65
- package/statistics/features/supported/data-access/data-access.d.ts +0 -15
- package/statistics/features/supported/data-access/data-access.js +0 -118
- package/statistics/features/supported/data-access/index.d.ts +0 -1
- package/statistics/features/supported/data-access/index.js +0 -6
- package/statistics/features/supported/data-access/post-process.d.ts +0 -3
- package/statistics/features/supported/data-access/post-process.js +0 -107
- package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -35
- package/statistics/features/supported/defined-functions/defined-functions.js +0 -139
- package/statistics/features/supported/defined-functions/index.d.ts +0 -1
- package/statistics/features/supported/defined-functions/index.js +0 -6
- package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/defined-functions/post-process.js +0 -177
- package/statistics/features/supported/expression-list/expression-list.d.ts +0 -9
- package/statistics/features/supported/expression-list/expression-list.js +0 -36
- package/statistics/features/supported/expression-list/index.d.ts +0 -1
- package/statistics/features/supported/expression-list/index.js +0 -6
- package/statistics/features/supported/expression-list/post-process.d.ts +0 -3
- package/statistics/features/supported/expression-list/post-process.js +0 -44
- package/statistics/features/supported/index.d.ts +0 -10
- package/statistics/features/supported/index.js +0 -27
- package/statistics/features/supported/loops/index.d.ts +0 -1
- package/statistics/features/supported/loops/index.js +0 -6
- package/statistics/features/supported/loops/loops.d.ts +0 -20
- package/statistics/features/supported/loops/loops.js +0 -79
- package/statistics/features/supported/loops/post-process.d.ts +0 -3
- package/statistics/features/supported/loops/post-process.js +0 -72
- package/statistics/features/supported/used-functions/index.d.ts +0 -1
- package/statistics/features/supported/used-functions/index.js +0 -6
- package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/used-functions/post-process.js +0 -179
- package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
- package/statistics/features/supported/used-functions/used-functions.js +0 -95
- package/statistics/features/supported/used-packages/index.d.ts +0 -1
- package/statistics/features/supported/used-packages/index.js +0 -6
- package/statistics/features/supported/used-packages/post-process.d.ts +0 -3
- package/statistics/features/supported/used-packages/post-process.js +0 -121
- package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
- package/statistics/features/supported/used-packages/used-packages.js +0 -130
- package/statistics/features/supported/values/index.d.ts +0 -1
- package/statistics/features/supported/values/index.js +0 -6
- package/statistics/features/supported/values/post-process.d.ts +0 -3
- package/statistics/features/supported/values/post-process.js +0 -72
- package/statistics/features/supported/values/values.d.ts +0 -14
- package/statistics/features/supported/values/values.js +0 -101
- package/statistics/features/supported/variables/index.d.ts +0 -1
- package/statistics/features/supported/variables/index.js +0 -6
- package/statistics/features/supported/variables/post-process.d.ts +0 -9
- package/statistics/features/supported/variables/post-process.js +0 -122
- package/statistics/features/supported/variables/variables.d.ts +0 -15
- package/statistics/features/supported/variables/variables.js +0 -70
- package/statistics/index.d.ts +0 -6
- package/statistics/index.js +0 -24
- package/statistics/meta-statistics.d.ts +0 -33
- package/statistics/meta-statistics.js +0 -17
- package/statistics/output/file-provider.d.ts +0 -37
- package/statistics/output/file-provider.js +0 -97
- package/statistics/output/index.d.ts +0 -4
- package/statistics/output/index.js +0 -21
- package/statistics/output/print-stats.d.ts +0 -17
- package/statistics/output/print-stats.js +0 -69
- package/statistics/output/statistics-file.d.ts +0 -37
- package/statistics/output/statistics-file.js +0 -69
- package/statistics/statistics.d.ts +0 -24
- package/statistics/statistics.js +0 -109
- package/util/summarizer/auto-detect.d.ts +0 -2
- package/util/summarizer/auto-detect.js +0 -32
- package/util/summarizer/benchmark/data.d.ts +0 -66
- package/util/summarizer/benchmark/data.js +0 -13
- package/util/summarizer/benchmark/first-phase/input.d.ts +0 -2
- package/util/summarizer/benchmark/first-phase/input.js +0 -59
- package/util/summarizer/benchmark/first-phase/process.d.ts +0 -10
- package/util/summarizer/benchmark/first-phase/process.js +0 -208
- package/util/summarizer/benchmark/second-phase/graph.d.ts +0 -2
- package/util/summarizer/benchmark/second-phase/graph.js +0 -54
- package/util/summarizer/benchmark/second-phase/process.d.ts +0 -4
- package/util/summarizer/benchmark/second-phase/process.js +0 -89
- package/util/summarizer/benchmark/summarizer.d.ts +0 -35
- package/util/summarizer/benchmark/summarizer.js +0 -49
- package/util/summarizer/statistics/first-phase/process.d.ts +0 -6
- package/util/summarizer/statistics/first-phase/process.js +0 -81
- package/util/summarizer/statistics/post-process/clusterer.d.ts +0 -26
- package/util/summarizer/statistics/post-process/clusterer.js +0 -43
- package/util/summarizer/statistics/post-process/file-based-count.d.ts +0 -17
- package/util/summarizer/statistics/post-process/file-based-count.js +0 -49
- package/util/summarizer/statistics/post-process/histogram.d.ts +0 -59
- package/util/summarizer/statistics/post-process/histogram.js +0 -128
- package/util/summarizer/statistics/post-process/index.d.ts +0 -4
- package/util/summarizer/statistics/post-process/index.js +0 -21
- package/util/summarizer/statistics/post-process/post-process-output.d.ts +0 -16
- package/util/summarizer/statistics/post-process/post-process-output.js +0 -104
- package/util/summarizer/statistics/second-phase/process.d.ts +0 -11
- package/util/summarizer/statistics/second-phase/process.js +0 -117
- package/util/summarizer/statistics/summarizer.d.ts +0 -35
- package/util/summarizer/statistics/summarizer.js +0 -135
- package/util/summarizer/summarizer.js +0 -13
- /package/{statistics/output → util}/ansi.d.ts +0 -0
|
@@ -1,133 +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.comments = exports.initialCommentInfo = void 0;
|
|
27
|
-
const xpath = __importStar(require("xpath-ts2"));
|
|
28
|
-
const assert_1 = require("../../../../util/assert");
|
|
29
|
-
const output_1 = require("../../../output");
|
|
30
|
-
const post_process_1 = require("./post-process");
|
|
31
|
-
exports.initialCommentInfo = {
|
|
32
|
-
totalAmount: 0,
|
|
33
|
-
roxygenComments: 0,
|
|
34
|
-
import: 0,
|
|
35
|
-
importFrom: 0,
|
|
36
|
-
importMethodsFrom: 0,
|
|
37
|
-
importClassesFrom: 0,
|
|
38
|
-
useDynLib: 0,
|
|
39
|
-
export: 0,
|
|
40
|
-
exportClass: 0,
|
|
41
|
-
exportMethod: 0,
|
|
42
|
-
exportS3Method: 0,
|
|
43
|
-
exportPattern: 0
|
|
44
|
-
};
|
|
45
|
-
const commentQuery = xpath.parse('//COMMENT');
|
|
46
|
-
const importRegex = /^'\s*@import\s+(?<package>\S+)/;
|
|
47
|
-
const importFromRegex = /^'\s*@importFrom\s+(?<package>\S+)(?<fn>( +\S+)+)$/;
|
|
48
|
-
const useDynLibRegex = /^'\s*@useDynLib\s+(?<package>\S+)(?<fn>( +\S+)+)?$/;
|
|
49
|
-
/** we still name the classes fn, so we can reuse processing code */
|
|
50
|
-
const importClassesFromRegex = /^'\s*@importClassesFrom\s+(?<package>\S+)(?<fn>( +\S+)+)$/;
|
|
51
|
-
const importMethodsFrom = /^'\s*@importMethodsFrom\s+(?<package>\S+)(?<fn>( +\S+)+)$/;
|
|
52
|
-
/** deliberately includes the others to get a "total" overview */
|
|
53
|
-
const exportRegex = /^'\s*@export/;
|
|
54
|
-
const exportS3MethodRegex = /^'\s*@exportS3Method/;
|
|
55
|
-
const exportClassRegex = /^'\s*@exportClass/;
|
|
56
|
-
const exportMethodRegex = /^'\s*@exportMethod/;
|
|
57
|
-
const exportPatternRegex = /^'\s*@exportPattern/;
|
|
58
|
-
function processRoxygenImport(existing, commentsText, filepath) {
|
|
59
|
-
const packages = commentsText.map(text => importRegex.exec(text)?.groups?.package).filter(assert_1.isNotUndefined);
|
|
60
|
-
existing.import += packages.length;
|
|
61
|
-
(0, output_1.appendStatisticsFile)(exports.comments.name, 'import', packages, filepath, true);
|
|
62
|
-
}
|
|
63
|
-
function processWithRegex(commentsText, existing, regex) {
|
|
64
|
-
return commentsText.map(text => regex.exec(text)).filter(assert_1.isNotNull)
|
|
65
|
-
.flatMap(match => {
|
|
66
|
-
const packageName = match.groups?.package ?? '<unknown>';
|
|
67
|
-
return (match.groups?.fn.trim().split(/\s+/) ?? []).map(fn => `${JSON.stringify(packageName)},${fn}`);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
function processRoxygenImportFrom(existing, commentsText, filepath) {
|
|
71
|
-
const result = processWithRegex(commentsText, existing, importFromRegex);
|
|
72
|
-
existing.importFrom += result.length;
|
|
73
|
-
(0, output_1.appendStatisticsFile)(exports.comments.name, 'importFrom', result, filepath, true);
|
|
74
|
-
}
|
|
75
|
-
function processRoxygenImportClassesFrom(existing, commentsText, filepath) {
|
|
76
|
-
const result = processWithRegex(commentsText, existing, importClassesFromRegex);
|
|
77
|
-
existing.importClassesFrom += result.length;
|
|
78
|
-
(0, output_1.appendStatisticsFile)(exports.comments.name, 'importClassesFrom', result, filepath, true);
|
|
79
|
-
}
|
|
80
|
-
function processRoxygenImportMethodsFrom(existing, commentsText, filepath) {
|
|
81
|
-
const result = processWithRegex(commentsText, existing, importMethodsFrom);
|
|
82
|
-
existing.importMethodsFrom += result.length;
|
|
83
|
-
(0, output_1.appendStatisticsFile)(exports.comments.name, 'importMethodsFrom', result, filepath, true);
|
|
84
|
-
}
|
|
85
|
-
function processExports(existing, comments) {
|
|
86
|
-
existing.export += comments.filter(text => exportRegex.test(text)).length;
|
|
87
|
-
existing.exportClass += comments.filter(text => exportClassRegex.test(text)).length;
|
|
88
|
-
existing.exportMethod += comments.filter(text => exportMethodRegex.test(text)).length;
|
|
89
|
-
existing.exportS3Method += comments.filter(text => exportS3MethodRegex.test(text)).length;
|
|
90
|
-
existing.exportPattern += comments.filter(text => exportPatternRegex.test(text)).length;
|
|
91
|
-
}
|
|
92
|
-
function processMatchForDynLib(match) {
|
|
93
|
-
const packageName = match.groups?.package ?? '<unknown>';
|
|
94
|
-
const functions = match.groups?.fn?.trim().split(/\s+/) ?? [];
|
|
95
|
-
if (functions.length === 0) {
|
|
96
|
-
return [packageName];
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
return functions.map(fn => `${JSON.stringify(packageName)},${fn}`);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
function processRoxygenUseDynLib(existing, commentsText, filepath) {
|
|
103
|
-
const result = commentsText.map(text => useDynLibRegex.exec(text))
|
|
104
|
-
.filter(assert_1.isNotNull)
|
|
105
|
-
.flatMap(processMatchForDynLib);
|
|
106
|
-
existing.useDynLib += result.length;
|
|
107
|
-
(0, output_1.appendStatisticsFile)(exports.comments.name, 'useDynLib', result, filepath, true);
|
|
108
|
-
}
|
|
109
|
-
exports.comments = {
|
|
110
|
-
name: 'Comments',
|
|
111
|
-
description: 'All comments that appear within the document',
|
|
112
|
-
process(existing, input) {
|
|
113
|
-
const comments = commentQuery.select({ node: input.parsedRAst }).map(node => node.textContent ?? '#')
|
|
114
|
-
.map(text => {
|
|
115
|
-
(0, assert_1.guard)(text.startsWith('#'), `unexpected comment ${text}`);
|
|
116
|
-
return text.slice(1);
|
|
117
|
-
})
|
|
118
|
-
.map(text => text.trim());
|
|
119
|
-
existing.totalAmount += comments.length;
|
|
120
|
-
const roxygenComments = comments.filter(text => text.startsWith("'"));
|
|
121
|
-
existing.roxygenComments += roxygenComments.length;
|
|
122
|
-
processRoxygenImport(existing, roxygenComments, input.filepath);
|
|
123
|
-
processRoxygenImportFrom(existing, roxygenComments, input.filepath);
|
|
124
|
-
processRoxygenUseDynLib(existing, roxygenComments, input.filepath);
|
|
125
|
-
processRoxygenImportClassesFrom(existing, roxygenComments, input.filepath);
|
|
126
|
-
processRoxygenImportMethodsFrom(existing, roxygenComments, input.filepath);
|
|
127
|
-
processExports(existing, roxygenComments);
|
|
128
|
-
return existing;
|
|
129
|
-
},
|
|
130
|
-
initialValue: exports.initialCommentInfo,
|
|
131
|
-
postProcess: post_process_1.postProcess
|
|
132
|
-
};
|
|
133
|
-
//# sourceMappingURL=comments.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { comments } from './comments';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.comments = void 0;
|
|
4
|
-
var comments_1 = require("./comments");
|
|
5
|
-
Object.defineProperty(exports, "comments", { enumerable: true, get: function () { return comments_1.comments; } });
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { FeatureStatisticsWithMeta } from '../../feature';
|
|
2
|
-
import type { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
|
|
3
|
-
export declare function postProcess(featureRoot: string, info: Map<string, FeatureStatisticsWithMeta>, outputPath: string, config: StatisticsSummarizerConfiguration): void;
|
|
@@ -1,50 +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.postProcess = void 0;
|
|
7
|
-
const data_1 = require("../../../../util/summarizer/benchmark/data");
|
|
8
|
-
const comments_1 = require("./comments");
|
|
9
|
-
const assert_1 = require("../../../../util/assert");
|
|
10
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
11
|
-
const path_1 = __importDefault(require("path"));
|
|
12
|
-
const process_1 = require("../../../../util/summarizer/benchmark/first-phase/process");
|
|
13
|
-
// monoids would be helpful :c
|
|
14
|
-
function appendCommentsPostProcessing(a, b, numberOfLines, filepath, skipForProjects) {
|
|
15
|
-
for (const [key, val] of Object.entries(b)) {
|
|
16
|
-
const get = a[key];
|
|
17
|
-
(0, assert_1.guard)(get !== undefined, `key ${key} is not present in the comments post processing`);
|
|
18
|
-
get.count.push(val);
|
|
19
|
-
get.fracOfLines.push(val / numberOfLines);
|
|
20
|
-
if (val > 0) {
|
|
21
|
-
get.uniqueFiles.add(filepath);
|
|
22
|
-
get.uniqueProjects.add(filepath.split(path_1.default.sep)[skipForProjects] ?? '');
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
const initialCommentsMeta = () => ({ count: [], uniqueProjects: new Set(), uniqueFiles: new Set(), fracOfLines: [] });
|
|
27
|
-
function mapComments(data, fn) {
|
|
28
|
-
const collected = {};
|
|
29
|
-
for (const [key, value] of Object.entries(data)) {
|
|
30
|
-
collected[key] = fn(value);
|
|
31
|
-
}
|
|
32
|
-
return collected;
|
|
33
|
-
}
|
|
34
|
-
function postProcess(featureRoot, info, outputPath, config) {
|
|
35
|
-
// for each we collect the count and the number of files that contain them
|
|
36
|
-
const collected = mapComments(comments_1.initialCommentInfo, initialCommentsMeta);
|
|
37
|
-
for (const [filepath, feature] of info.entries()) {
|
|
38
|
-
appendCommentsPostProcessing(collected, feature.comments, feature.stats.lines[0].length, filepath, config.projectSkip);
|
|
39
|
-
}
|
|
40
|
-
const fnOutStream = node_fs_1.default.createWriteStream(path_1.default.join(outputPath, 'comments.csv'));
|
|
41
|
-
fnOutStream.write(`kind,unique-projects,unique-files,${(0, data_1.summarizedMeasurement2CsvHeader)('count')},${(0, data_1.summarizedMeasurement2CsvHeader)('frac-of-lines')}\n`);
|
|
42
|
-
for (const [key, val] of Object.entries(collected)) {
|
|
43
|
-
const { count, uniqueProjects, uniqueFiles, fracOfLines } = val;
|
|
44
|
-
const counts = (0, process_1.summarizeMeasurement)(count);
|
|
45
|
-
const lineFrac = (0, process_1.summarizeMeasurement)(fracOfLines);
|
|
46
|
-
fnOutStream.write(`${JSON.stringify(key)},${uniqueProjects.size},${uniqueFiles.size},${(0, data_1.summarizedMeasurement2Csv)(counts)},${(0, data_1.summarizedMeasurement2Csv)(lineFrac)}\n`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.postProcess = postProcess;
|
|
50
|
-
//# sourceMappingURL=post-process.js.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Feature } from '../../feature';
|
|
2
|
-
import type { Writable } from 'ts-essentials';
|
|
3
|
-
declare const initialControlflowInfo: {
|
|
4
|
-
ifThen: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
5
|
-
thenBody: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
6
|
-
ifThenElse: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
7
|
-
elseBody: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
8
|
-
/** can be nested with if-s or if-then-else's */
|
|
9
|
-
nestedIfThen: number;
|
|
10
|
-
nestedIfThenElse: number;
|
|
11
|
-
deepestNesting: number;
|
|
12
|
-
/** switch(...) */
|
|
13
|
-
switchCase: import("../../common-syntax-probability").CommonSyntaxTypeCounts<bigint>;
|
|
14
|
-
};
|
|
15
|
-
export type ControlflowInfo = Writable<typeof initialControlflowInfo>;
|
|
16
|
-
export declare const controlflow: Feature<ControlflowInfo>;
|
|
17
|
-
export {};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.controlflow = void 0;
|
|
4
|
-
const common_syntax_probability_1 = require("../../common-syntax-probability");
|
|
5
|
-
const r_bridge_1 = require("../../../../r-bridge");
|
|
6
|
-
const post_process_1 = require("./post-process");
|
|
7
|
-
const initialControlflowInfo = {
|
|
8
|
-
ifThen: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(),
|
|
9
|
-
thenBody: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(),
|
|
10
|
-
ifThenElse: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(),
|
|
11
|
-
elseBody: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(),
|
|
12
|
-
/** can be nested with if-s or if-then-else's */
|
|
13
|
-
nestedIfThen: 0,
|
|
14
|
-
nestedIfThenElse: 0,
|
|
15
|
-
deepestNesting: 0,
|
|
16
|
-
/** switch(...) */
|
|
17
|
-
switchCase: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)()
|
|
18
|
-
};
|
|
19
|
-
function visitIfThenElse(info, input) {
|
|
20
|
-
const ifThenElseStack = [];
|
|
21
|
-
(0, r_bridge_1.visitAst)(input.normalizedRAst.ast, node => {
|
|
22
|
-
if (node.type !== "RIfThenElse" /* RType.IfThenElse */) {
|
|
23
|
-
if (node.type === "RFunctionCall" /* RType.FunctionCall */ && node.flavor === 'named' && node.functionName.content === 'switch') {
|
|
24
|
-
const initialArg = node.arguments[0];
|
|
25
|
-
if (initialArg) {
|
|
26
|
-
info.switchCase = (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(info.switchCase, initialArg);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const ifThenElse = node.otherwise !== undefined;
|
|
32
|
-
if (ifThenElseStack.length > 0) {
|
|
33
|
-
if (ifThenElse) {
|
|
34
|
-
info.nestedIfThenElse++;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
info.nestedIfThen++;
|
|
38
|
-
}
|
|
39
|
-
info.deepestNesting = Math.max(info.deepestNesting, ifThenElseStack.length);
|
|
40
|
-
}
|
|
41
|
-
ifThenElseStack.push(node);
|
|
42
|
-
info.thenBody = (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(info.thenBody, ...node.then.children);
|
|
43
|
-
if (ifThenElse) {
|
|
44
|
-
info.ifThenElse = (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(info.ifThenElse, node.condition);
|
|
45
|
-
info.elseBody = (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(info.elseBody, ...node.otherwise.children);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
info.ifThen = (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(info.ifThen, node.condition);
|
|
49
|
-
}
|
|
50
|
-
}, node => {
|
|
51
|
-
// drop again :D
|
|
52
|
-
if (node.type === "RIfThenElse" /* RType.IfThenElse */) {
|
|
53
|
-
ifThenElseStack.pop();
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
exports.controlflow = {
|
|
58
|
-
name: 'Controlflow',
|
|
59
|
-
description: 'Deals with if-then-else and switch-case',
|
|
60
|
-
process(existing, input) {
|
|
61
|
-
visitIfThenElse(existing, input);
|
|
62
|
-
return existing;
|
|
63
|
-
},
|
|
64
|
-
initialValue: initialControlflowInfo,
|
|
65
|
-
postProcess: post_process_1.postProcess
|
|
66
|
-
};
|
|
67
|
-
//# sourceMappingURL=control-flow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { controlflow } from './control-flow';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.controlflow = void 0;
|
|
4
|
-
var control_flow_1 = require("./control-flow");
|
|
5
|
-
Object.defineProperty(exports, "controlflow", { enumerable: true, get: function () { return control_flow_1.controlflow; } });
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { FeatureStatisticsWithMeta } from '../../feature';
|
|
2
|
-
import type { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
|
|
3
|
-
export declare function postProcess(featureRoot: string, info: Map<string, FeatureStatisticsWithMeta>, outputPath: string, config: StatisticsSummarizerConfiguration): void;
|
|
@@ -1,65 +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.postProcess = void 0;
|
|
7
|
-
const common_syntax_probability_1 = require("../../common-syntax-probability");
|
|
8
|
-
const post_processing_1 = require("../../post-processing");
|
|
9
|
-
const data_1 = require("../../../../util/summarizer/benchmark/data");
|
|
10
|
-
const process_1 = require("../../../../util/summarizer/benchmark/first-phase/process");
|
|
11
|
-
const fs_1 = __importDefault(require("fs"));
|
|
12
|
-
const path_1 = __importDefault(require("path"));
|
|
13
|
-
function postProcess(featureRoot, info, outputPath, config) {
|
|
14
|
-
const collected = {
|
|
15
|
-
ifThen: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => []),
|
|
16
|
-
thenBody: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => []),
|
|
17
|
-
ifThenElse: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => []),
|
|
18
|
-
elseBody: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => []),
|
|
19
|
-
nestedIfThen: (0, post_processing_1.emptySummarizedWithProject)(),
|
|
20
|
-
nestedIfThenElse: (0, post_processing_1.emptySummarizedWithProject)(),
|
|
21
|
-
deepestNesting: (0, post_processing_1.emptySummarizedWithProject)(),
|
|
22
|
-
switchCase: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => [])
|
|
23
|
-
};
|
|
24
|
-
for (const [filepath, data] of info.entries()) {
|
|
25
|
-
const value = data.controlflow;
|
|
26
|
-
for (const [key, val] of Object.entries(value)) {
|
|
27
|
-
if (typeof val === 'object') {
|
|
28
|
-
(0, common_syntax_probability_1.appendCommonSyntaxTypeCounter)(collected[key], val);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
const get = collected[key];
|
|
32
|
-
get.count.push(val);
|
|
33
|
-
if (val > 0) {
|
|
34
|
-
(0, post_processing_1.recordFilePath)(get, filepath, config);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
const metaOut = fs_1.default.createWriteStream(path_1.default.join(outputPath, 'control-flow-meta.csv'));
|
|
40
|
-
metaOut.write(`kind,unique-projects,unique-files,${(0, data_1.summarizedMeasurement2CsvHeader)()}\n`);
|
|
41
|
-
for (const [key, val] of Object.entries(collected)) {
|
|
42
|
-
const data = val;
|
|
43
|
-
if ('uniqueProjects' in data) {
|
|
44
|
-
metaOut.write(`${JSON.stringify(key)},${data.uniqueProjects.size},${data.uniqueFiles.size},${(0, data_1.summarizedMeasurement2Csv)((0, process_1.summarizeMeasurement)(data.count))}\n`);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
const out = fs_1.default.createWriteStream(path_1.default.join(outputPath, `control-flow-type-${key}.csv`));
|
|
48
|
-
// name is for fields like number etc. to allow to group multiple entries
|
|
49
|
-
out.write(`kind,name,${(0, data_1.summarizedMeasurement2CsvHeader)()}\n`);
|
|
50
|
-
for (const [name, vals] of Object.entries(data)) {
|
|
51
|
-
if (Array.isArray(vals)) {
|
|
52
|
-
out.write(`${JSON.stringify(name)},"",${(0, data_1.summarizedMeasurement2Csv)((0, process_1.summarizeMeasurement)(vals.flat()))}\n`);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
for (const [keyName, keyValue] of Object.entries(vals)) {
|
|
56
|
-
out.write(`${JSON.stringify(name)},${JSON.stringify(keyName)},${(0, data_1.summarizedMeasurement2Csv)((0, process_1.summarizeMeasurement)(keyValue.flat()))}\n`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
out.close();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.postProcess = postProcess;
|
|
65
|
-
//# sourceMappingURL=post-process.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Feature } from '../../feature';
|
|
2
|
-
import type { Writable } from 'ts-essentials';
|
|
3
|
-
import type { CommonSyntaxTypeCounts } from '../../common-syntax-probability';
|
|
4
|
-
declare const initialDataAccessInfo: {
|
|
5
|
-
singleBracket: Record<number, bigint | CommonSyntaxTypeCounts<bigint>>;
|
|
6
|
-
doubleBracket: Record<number, bigint | CommonSyntaxTypeCounts<bigint>>;
|
|
7
|
-
chainedOrNestedAccess: number;
|
|
8
|
-
longestChain: number;
|
|
9
|
-
deepestNesting: number;
|
|
10
|
-
byName: number;
|
|
11
|
-
bySlot: number;
|
|
12
|
-
};
|
|
13
|
-
export type DataAccessInfo = Writable<typeof initialDataAccessInfo>;
|
|
14
|
-
export declare const dataAccess: Feature<DataAccessInfo>;
|
|
15
|
-
export {};
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dataAccess = void 0;
|
|
4
|
-
const r_bridge_1 = require("../../../../r-bridge");
|
|
5
|
-
const assert_1 = require("../../../../util/assert");
|
|
6
|
-
const output_1 = require("../../../output");
|
|
7
|
-
const common_syntax_probability_1 = require("../../common-syntax-probability");
|
|
8
|
-
const post_process_1 = require("./post-process");
|
|
9
|
-
const initialDataAccessInfo = {
|
|
10
|
-
// for the nth argument, how many of them are constant etc.
|
|
11
|
-
singleBracket: {
|
|
12
|
-
// only counts if empty
|
|
13
|
-
0: 0n,
|
|
14
|
-
1: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)()
|
|
15
|
-
},
|
|
16
|
-
doubleBracket: {
|
|
17
|
-
// similar to single bracket
|
|
18
|
-
0: 0n,
|
|
19
|
-
1: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)()
|
|
20
|
-
},
|
|
21
|
-
chainedOrNestedAccess: 0,
|
|
22
|
-
longestChain: 0,
|
|
23
|
-
deepestNesting: 0,
|
|
24
|
-
byName: 0,
|
|
25
|
-
bySlot: 0,
|
|
26
|
-
};
|
|
27
|
-
function classifyArguments(args, existing) {
|
|
28
|
-
if (args.length === 0) {
|
|
29
|
-
existing[0]++;
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
let i = 1;
|
|
33
|
-
for (const arg of args) {
|
|
34
|
-
if (arg === null) {
|
|
35
|
-
existing[0]++;
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
existing[i] = (0, common_syntax_probability_1.updateCommonSyntaxTypeCounts)(existing[i] ?? (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(), arg);
|
|
39
|
-
i++;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function visitAccess(info, input) {
|
|
43
|
-
const accessNest = [];
|
|
44
|
-
const accessChain = [];
|
|
45
|
-
const parentRoleCache = new Map();
|
|
46
|
-
(0, r_bridge_1.visitAst)(input.normalizedRAst.ast, node => {
|
|
47
|
-
if (node.type !== "RAccess" /* RType.Access */) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const roles = (0, r_bridge_1.rolesOfParents)(node, input.normalizedRAst.idMap);
|
|
51
|
-
let acc = false;
|
|
52
|
-
let idxAcc = false;
|
|
53
|
-
for (const role of roles) {
|
|
54
|
-
if (role === "accessed" /* RoleInParent.Accessed */) {
|
|
55
|
-
acc = true;
|
|
56
|
-
break; // we only account for the first one
|
|
57
|
-
}
|
|
58
|
-
else if (role === "index-access" /* RoleInParent.IndexAccess */) {
|
|
59
|
-
idxAcc = true;
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
// here we have to check after the addition as we can only check the parental context
|
|
64
|
-
if (acc) {
|
|
65
|
-
accessChain.push(node);
|
|
66
|
-
info.chainedOrNestedAccess++;
|
|
67
|
-
info.longestChain = Math.max(info.longestChain, accessChain.length);
|
|
68
|
-
}
|
|
69
|
-
else if (idxAcc) {
|
|
70
|
-
accessNest.push(node);
|
|
71
|
-
info.chainedOrNestedAccess++;
|
|
72
|
-
info.deepestNesting = Math.max(info.deepestNesting, accessNest.length);
|
|
73
|
-
}
|
|
74
|
-
parentRoleCache.set(node.info.id, { acc, idxAcc });
|
|
75
|
-
if (accessNest.length === 0 && accessChain.length === 0) { // store topmost, after add as it must not be a child to do that
|
|
76
|
-
(0, output_1.appendStatisticsFile)(exports.dataAccess.name, 'dataAccess', [node.info.fullLexeme ?? node.lexeme], input.filepath);
|
|
77
|
-
}
|
|
78
|
-
const op = node.operator;
|
|
79
|
-
switch (op) {
|
|
80
|
-
case '@':
|
|
81
|
-
info.bySlot++;
|
|
82
|
-
return;
|
|
83
|
-
case '$':
|
|
84
|
-
info.byName++;
|
|
85
|
-
return;
|
|
86
|
-
case '[':
|
|
87
|
-
classifyArguments(node.access, info.singleBracket);
|
|
88
|
-
break;
|
|
89
|
-
case '[[':
|
|
90
|
-
classifyArguments(node.access, info.doubleBracket);
|
|
91
|
-
break;
|
|
92
|
-
default: (0, assert_1.assertUnreachable)(op);
|
|
93
|
-
}
|
|
94
|
-
(0, assert_1.guard)(Array.isArray(node.access), '[ and [[ must provide access as array');
|
|
95
|
-
}, node => {
|
|
96
|
-
// drop again :D
|
|
97
|
-
if (node.type === "RAccess" /* RType.Access */) {
|
|
98
|
-
const ctx = parentRoleCache.get(node.info.id);
|
|
99
|
-
if (ctx?.acc) {
|
|
100
|
-
accessChain.pop();
|
|
101
|
-
}
|
|
102
|
-
else if (ctx?.idxAcc) {
|
|
103
|
-
accessNest.pop();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
exports.dataAccess = {
|
|
109
|
-
name: 'Data Access',
|
|
110
|
-
description: 'Ways of accessing data structures in R',
|
|
111
|
-
process(existing, input) {
|
|
112
|
-
visitAccess(existing, input);
|
|
113
|
-
return existing;
|
|
114
|
-
},
|
|
115
|
-
initialValue: initialDataAccessInfo,
|
|
116
|
-
postProcess: post_process_1.postProcess
|
|
117
|
-
};
|
|
118
|
-
//# sourceMappingURL=data-access.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { dataAccess } from './data-access';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dataAccess = void 0;
|
|
4
|
-
var data_access_1 = require("./data-access");
|
|
5
|
-
Object.defineProperty(exports, "dataAccess", { enumerable: true, get: function () { return data_access_1.dataAccess; } });
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { FeatureStatisticsWithMeta } from '../../feature';
|
|
2
|
-
import type { StatisticsSummarizerConfiguration } from '../../../../util/summarizer/statistics/summarizer';
|
|
3
|
-
export declare function postProcess(featureRoot: string, info: Map<string, FeatureStatisticsWithMeta>, outputPath: string, config: StatisticsSummarizerConfiguration): void;
|
|
@@ -1,107 +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.postProcess = void 0;
|
|
7
|
-
const data_1 = require("../../../../util/summarizer/benchmark/data");
|
|
8
|
-
const common_syntax_probability_1 = require("../../common-syntax-probability");
|
|
9
|
-
const post_processing_1 = require("../../post-processing");
|
|
10
|
-
const numbers_1 = require("../../../../util/numbers");
|
|
11
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
12
|
-
const path_1 = __importDefault(require("path"));
|
|
13
|
-
const process_1 = require("../../../../util/summarizer/benchmark/first-phase/process");
|
|
14
|
-
function addToList(data, dataAccess, filepath, config) {
|
|
15
|
-
data.count.push(dataAccess);
|
|
16
|
-
if (dataAccess > 0) {
|
|
17
|
-
(0, post_processing_1.recordFilePath)(data, filepath, config);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function summarizeForBracket(dataAccess, data, filepath, config) {
|
|
21
|
-
for (const [key, val] of Object.entries(dataAccess)) {
|
|
22
|
-
const numericKey = Number(key);
|
|
23
|
-
const get = data.get(numericKey) ?? (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(() => []);
|
|
24
|
-
if (typeof val === 'bigint' || typeof val === 'string') {
|
|
25
|
-
// it is for argument 0
|
|
26
|
-
const sumGet = get;
|
|
27
|
-
const numericVal = (0, numbers_1.bigint2number)(val);
|
|
28
|
-
sumGet.count.push(numericVal);
|
|
29
|
-
if (numericVal > 0) {
|
|
30
|
-
(0, post_processing_1.recordFilePath)(sumGet, filepath, config);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
(0, common_syntax_probability_1.appendCommonSyntaxTypeCounter)(get, val);
|
|
35
|
-
}
|
|
36
|
-
data.set(numericKey, get);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function writeSingleOrDoubleEmpty(outputPath, key, name, vals) {
|
|
40
|
-
const out = node_fs_1.default.createWriteStream(path_1.default.join(outputPath, `data-access-type-${key}-${name}.csv`));
|
|
41
|
-
// name is for fields like number etc. to allow to group multiple entries
|
|
42
|
-
out.write(`kind,unique-projects,unique-files,${(0, data_1.summarizedMeasurement2CsvHeader)()}\n`);
|
|
43
|
-
out.write(`"0",${vals.uniqueProjects.size},${vals.uniqueFiles.size},${(0, data_1.summarizedMeasurement2Csv)((0, process_1.summarizeMeasurement)(vals.count))}\n`);
|
|
44
|
-
out.close();
|
|
45
|
-
}
|
|
46
|
-
function writeSingleOrDoubleBrackets(data, outputPath, key) {
|
|
47
|
-
for (const [name, vals] of data.entries()) {
|
|
48
|
-
// the 0 column
|
|
49
|
-
if ('uniqueProjects' in vals) {
|
|
50
|
-
writeSingleOrDoubleEmpty(outputPath, key, name, vals);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
// non-0-column
|
|
54
|
-
const out = node_fs_1.default.createWriteStream(path_1.default.join(outputPath, `data-access-type-${key}-${name}.csv`));
|
|
55
|
-
// name is for fields like number etc. to allow to group multiple entries
|
|
56
|
-
out.write(`kind,name,${(0, data_1.summarizedMeasurement2CsvHeader)()}\n`);
|
|
57
|
-
for (const [entryName, values] of Object.entries(vals)) {
|
|
58
|
-
if (Array.isArray(values)) {
|
|
59
|
-
out.write(`${JSON.stringify(entryName)},"",${(0, data_1.summarizedMeasurement2Csv)((0, process_1.summarizeMeasurement)(values.flat()))}\n`);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
for (const [keyName, keyValue] of Object.entries(values)) {
|
|
63
|
-
out.write(`${JSON.stringify(entryName)},${JSON.stringify(keyName)},${(0, data_1.summarizedMeasurement2Csv)((0, process_1.summarizeMeasurement)(keyValue.flat()))}\n`);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
out.close();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function postProcess(featureRoot, info, outputPath, config) {
|
|
72
|
-
const summarize = {
|
|
73
|
-
singleBracket: new Map(),
|
|
74
|
-
doubleBracket: new Map(),
|
|
75
|
-
chainedOrNestedAccess: (0, post_processing_1.emptySummarizedWithProject)(),
|
|
76
|
-
longestChain: (0, post_processing_1.emptySummarizedWithProject)(),
|
|
77
|
-
deepestNesting: (0, post_processing_1.emptySummarizedWithProject)(),
|
|
78
|
-
byName: (0, post_processing_1.emptySummarizedWithProject)(),
|
|
79
|
-
bySlot: (0, post_processing_1.emptySummarizedWithProject)()
|
|
80
|
-
};
|
|
81
|
-
// initialize the special 0
|
|
82
|
-
summarize.singleBracket.set(0, (0, post_processing_1.emptySummarizedWithProject)());
|
|
83
|
-
summarize.doubleBracket.set(0, (0, post_processing_1.emptySummarizedWithProject)());
|
|
84
|
-
for (const [filepath, value] of info.entries()) {
|
|
85
|
-
const dataAccess = value.dataAccess;
|
|
86
|
-
addToList(summarize.chainedOrNestedAccess, dataAccess.chainedOrNestedAccess, filepath, config);
|
|
87
|
-
addToList(summarize.longestChain, dataAccess.longestChain, filepath, config);
|
|
88
|
-
addToList(summarize.deepestNesting, dataAccess.deepestNesting, filepath, config);
|
|
89
|
-
addToList(summarize.byName, dataAccess.byName, filepath, config);
|
|
90
|
-
addToList(summarize.bySlot, dataAccess.bySlot, filepath, config);
|
|
91
|
-
summarizeForBracket(dataAccess.singleBracket, summarize.singleBracket, filepath, config);
|
|
92
|
-
summarizeForBracket(dataAccess.doubleBracket, summarize.doubleBracket, filepath, config);
|
|
93
|
-
}
|
|
94
|
-
const metaOut = node_fs_1.default.createWriteStream(path_1.default.join(outputPath, 'data-access-meta.csv'));
|
|
95
|
-
metaOut.write(`kind,unique-projects,unique-files,${(0, data_1.summarizedMeasurement2CsvHeader)()}\n`);
|
|
96
|
-
for (const [key, value] of Object.entries(summarize)) {
|
|
97
|
-
const data = value;
|
|
98
|
-
if ('uniqueProjects' in data) {
|
|
99
|
-
metaOut.write(`${JSON.stringify(key)},${data.uniqueProjects.size},${data.uniqueFiles.size},${(0, data_1.summarizedMeasurement2Csv)((0, process_1.summarizeMeasurement)(data.count))}\n`);
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
writeSingleOrDoubleBrackets(data, outputPath, key);
|
|
103
|
-
}
|
|
104
|
-
metaOut.close();
|
|
105
|
-
}
|
|
106
|
-
exports.postProcess = postProcess;
|
|
107
|
-
//# sourceMappingURL=post-process.js.map
|