@eagleoutice/flowr 2.2.2 → 2.2.4
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 +412 -39
- package/benchmark/slicer.js +0 -1
- package/benchmark/summarizer/first-phase/process.js +18 -8
- package/benchmark/summarizer/summarizer.d.ts +1 -1
- package/benchmark/summarizer/summarizer.js +1 -1
- package/cli/benchmark-app.js +1 -1
- package/cli/common/script.js +0 -1
- package/cli/repl/commands/repl-cfg.js +38 -8
- package/cli/repl/commands/repl-commands.js +1 -1
- package/cli/repl/commands/repl-dataflow.js +45 -12
- package/cli/repl/commands/repl-normalize.js +38 -8
- package/cli/repl/commands/repl-parse.js +43 -2
- package/cli/repl/commands/repl-query.js +2 -2
- package/cli/repl/core.js +17 -8
- package/cli/repl/print-version.d.ts +1 -0
- package/cli/repl/print-version.js +8 -2
- package/cli/repl/server/connection.js +27 -15
- package/cli/repl/server/messages/all-messages.js +17 -7
- package/cli/repl/server/messages/message-repl.js +17 -7
- package/cli/repl/server/messages/message-slice.js +17 -7
- package/cli/script-core/statistics-helper-core.js +0 -1
- package/core/pipeline-executor.d.ts +6 -0
- package/core/pipeline-executor.js +8 -0
- package/core/print/dataflow-printer.js +3 -0
- package/core/print/normalize-printer.js +0 -1
- package/core/steps/all/core/01-parse-tree-sitter.d.ts +7 -0
- package/core/steps/pipeline/default-pipelines.d.ts +57 -47
- package/core/steps/pipeline/default-pipelines.js +23 -2
- package/core/steps/pipeline/pipeline.d.ts +1 -1
- package/core/steps/pipeline/pipeline.js +1 -1
- package/core/steps/pipeline-step.d.ts +1 -3
- package/dataflow/environments/resolve-by-name.d.ts +5 -2
- package/dataflow/environments/resolve-by-name.js +6 -4
- package/dataflow/extractor.d.ts +10 -0
- package/dataflow/extractor.js +10 -0
- package/dataflow/graph/resolve-graph.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +20 -4
- package/documentation/data/server/doc-data-server-messages.js +1 -2
- package/documentation/doc-util/doc-auto-gen.d.ts +1 -0
- package/documentation/doc-util/doc-auto-gen.js +5 -1
- package/documentation/doc-util/doc-benchmarks.d.ts +23 -0
- package/documentation/doc-util/doc-benchmarks.js +76 -0
- package/documentation/doc-util/doc-code.d.ts +1 -0
- package/documentation/doc-util/doc-code.js +4 -0
- package/documentation/doc-util/doc-dfg.d.ts +5 -3
- package/documentation/doc-util/doc-dfg.js +10 -8
- package/documentation/doc-util/doc-files.d.ts +2 -1
- package/documentation/doc-util/doc-files.js +3 -2
- package/documentation/doc-util/doc-normalized-ast.d.ts +2 -1
- package/documentation/doc-util/doc-normalized-ast.js +4 -5
- package/documentation/doc-util/doc-repl.d.ts +6 -2
- package/documentation/doc-util/doc-repl.js +10 -6
- package/documentation/doc-util/doc-server-message.js +1 -1
- package/documentation/doc-util/doc-structure.d.ts +1 -1
- package/documentation/doc-util/doc-structure.js +2 -2
- package/documentation/doc-util/doc-types.d.ts +8 -5
- package/documentation/doc-util/doc-types.js +31 -18
- package/documentation/index.d.ts +9 -0
- package/documentation/index.js +26 -0
- package/documentation/print-capabilities-markdown.js +105 -19
- package/documentation/print-core-wiki.d.ts +1 -0
- package/documentation/print-core-wiki.js +413 -0
- package/documentation/print-dataflow-graph-wiki.js +27 -27
- package/documentation/print-interface-wiki.js +22 -16
- package/documentation/print-linting-and-testing-wiki.js +29 -9
- package/documentation/print-normalized-ast-wiki.js +22 -17
- package/documentation/print-query-wiki.js +7 -7
- package/documentation/print-readme.d.ts +1 -0
- package/documentation/print-readme.js +160 -0
- package/documentation/print-search-wiki.js +2 -1
- package/package.json +30 -41
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +77 -45
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +3 -0
- package/queries/catalog/dependencies-query/dependencies-query-format.js +3 -2
- package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
- package/queries/catalog/search-query/search-query-format.js +1 -1
- package/r-bridge/data/data.d.ts +48 -7
- package/r-bridge/data/data.js +62 -8
- package/r-bridge/data/types.d.ts +7 -1
- package/r-bridge/lang-4.x/ast/model/model.d.ts +2 -3
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +2 -5
- package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +6 -0
- package/r-bridge/lang-4.x/ast/parser/json/format.js +6 -0
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +13 -2
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +19 -3
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +3 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +1 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +3 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +6 -1
- package/r-bridge/parser.d.ts +10 -0
- package/r-bridge/parser.js +26 -2
- package/r-bridge/shell.js +18 -8
- package/search/flowr-search-builder.d.ts +1 -2
- package/search/flowr-search-builder.js +1 -3
- package/statistics/features/supported/comments/comments.js +17 -7
- package/statistics/features/supported/used-functions/post-process.js +0 -1
- package/statistics/features/supported/used-packages/used-packages.js +17 -7
- package/statistics/features/supported/values/values.js +17 -7
- package/statistics/summarizer/summarizer.js +1 -2
- package/util/files.js +17 -7
- package/util/json.js +0 -2
- package/util/mermaid/dfg.d.ts +3 -0
- package/util/mermaid/dfg.js +24 -8
- package/util/numbers.d.ts +1 -0
- package/util/numbers.js +5 -0
- package/util/parallel.js +17 -7
- package/util/quads.js +3 -3
- package/util/strings.d.ts +9 -0
- package/util/strings.js +14 -0
- package/util/version.js +1 -1
|
@@ -23,9 +23,8 @@ import type { RUnaryOp } from './nodes/r-unary-op';
|
|
|
23
23
|
import type { RBinaryOp } from './nodes/r-binary-op';
|
|
24
24
|
import type { RPipe } from './nodes/r-pipe';
|
|
25
25
|
import type { RDelimiter } from './nodes/info/r-delimiter';
|
|
26
|
-
/** Simply an empty
|
|
27
|
-
export
|
|
28
|
-
}
|
|
26
|
+
/** Simply an empty type constraint used to say that there are additional decorations (see {@link Base}). */
|
|
27
|
+
export type NoInfo = object;
|
|
29
28
|
/**
|
|
30
29
|
* Will be used to reconstruct the source of the given element in the R-ast.
|
|
31
30
|
* This will not be part of most comparisons as it is mainly of interest to the reconstruction of R code.
|
|
@@ -74,6 +74,8 @@ export interface NormalizedAst<OtherInfo = ParentInformation, Node = RNode<Other
|
|
|
74
74
|
idMap: AstIdMap<OtherInfo>;
|
|
75
75
|
/** The root of the AST with parent information */
|
|
76
76
|
ast: Node;
|
|
77
|
+
/** marks whether the AST contains potential syntax errors */
|
|
78
|
+
hasError?: boolean;
|
|
77
79
|
}
|
|
78
80
|
export interface NormalizedAstDecorationConfiguration<OtherInfo> {
|
|
79
81
|
/** The id generator: must generate a unique id für each passed node */
|
|
@@ -27,10 +27,7 @@ function recoverName(id, idMap) {
|
|
|
27
27
|
*/
|
|
28
28
|
function recoverContent(id, graph) {
|
|
29
29
|
const vertex = graph.getVertex(id);
|
|
30
|
-
if (vertex ===
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
if (vertex.tag === vertex_1.VertexType.FunctionCall && vertex.name) {
|
|
30
|
+
if (vertex && vertex.tag === vertex_1.VertexType.FunctionCall && vertex.name) {
|
|
34
31
|
return vertex.name;
|
|
35
32
|
}
|
|
36
33
|
const node = graph.idMap?.get(id);
|
|
@@ -38,7 +35,7 @@ function recoverContent(id, graph) {
|
|
|
38
35
|
return undefined;
|
|
39
36
|
}
|
|
40
37
|
const lexeme = node.lexeme ?? node.info.fullLexeme ?? '';
|
|
41
|
-
if (vertex
|
|
38
|
+
if (vertex?.tag === vertex_1.VertexType.Use) {
|
|
42
39
|
return (0, retriever_1.removeRQuotes)(lexeme);
|
|
43
40
|
}
|
|
44
41
|
return lexeme;
|
|
@@ -36,6 +36,12 @@ export interface NamedJsonEntry {
|
|
|
36
36
|
name: RawRType;
|
|
37
37
|
content: JsonEntry;
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Takes the raw {@link RShell} output and extracts the csv information contained
|
|
41
|
+
*/
|
|
39
42
|
export declare function prepareParsedData(data: string): CsvEntry[];
|
|
43
|
+
/**
|
|
44
|
+
* Takes the CSV-Entries and maps them to the old json format for compatibility.
|
|
45
|
+
*/
|
|
40
46
|
export declare function convertPreparedParsedData(roots: readonly CsvEntry[]): JsonEntry;
|
|
41
47
|
export {};
|
|
@@ -7,6 +7,9 @@ const retriever_1 = require("../../../../retriever");
|
|
|
7
7
|
const assert_1 = require("../../../../../util/assert");
|
|
8
8
|
const type_1 = require("../../model/type");
|
|
9
9
|
exports.RootId = 0;
|
|
10
|
+
/**
|
|
11
|
+
* Takes the raw {@link RShell} output and extracts the csv information contained
|
|
12
|
+
*/
|
|
10
13
|
function prepareParsedData(data) {
|
|
11
14
|
let json;
|
|
12
15
|
try {
|
|
@@ -36,6 +39,9 @@ function prepareParsedData(data) {
|
|
|
36
39
|
}
|
|
37
40
|
return roots;
|
|
38
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Takes the CSV-Entries and maps them to the old json format for compatibility.
|
|
44
|
+
*/
|
|
39
45
|
function convertPreparedParsedData(roots) {
|
|
40
46
|
const partialEntry = {
|
|
41
47
|
token: type_1.RawRType.ExpressionList,
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import type { IdGenerator, NormalizedAst } from '../../model/processing/decorate';
|
|
2
|
-
import type { NoInfo } from '../../model/model';
|
|
2
|
+
import type { NoInfo, RNode } from '../../model/model';
|
|
3
3
|
import type { ParseStepOutputTS } from '../../../../../core/steps/all/core/01-parse-tree-sitter';
|
|
4
4
|
import type { ParseStepOutput } from '../../../../parser';
|
|
5
5
|
export declare const parseLog: import("tslog").Logger<import("tslog").ILogObj>;
|
|
6
6
|
/**
|
|
7
7
|
* Take the output as produced by the parse step and normalize the AST from the R parser.
|
|
8
|
+
*
|
|
9
|
+
* @see {@link normalizeButNotDecorated} for a version that does not decorate the AST
|
|
10
|
+
* @see {@link normalizeTreeSitter} for a version that normalizes the AST from the TreeSitter parser
|
|
11
|
+
*/
|
|
12
|
+
export declare function normalize(parsed: ParseStepOutput<string>, getId?: IdGenerator<NoInfo>, file?: string): NormalizedAst;
|
|
13
|
+
/**
|
|
14
|
+
* Take the output as produced by the parse step and normalize the AST from the R parser.
|
|
15
|
+
* For additional decoration with ${@link decorateAst} use {@link normalize}.
|
|
16
|
+
*/
|
|
17
|
+
export declare function normalizeButNotDecorated({ parsed }: ParseStepOutput<string>): RNode;
|
|
18
|
+
/**
|
|
19
|
+
* Tree-Sitter pendant to {@link normalize}.
|
|
8
20
|
*/
|
|
9
|
-
export declare function normalize({ parsed }: ParseStepOutput<string>, getId?: IdGenerator<NoInfo>, file?: string): NormalizedAst;
|
|
10
21
|
export declare function normalizeTreeSitter({ parsed }: ParseStepOutputTS, getId?: IdGenerator<NoInfo>, file?: string): NormalizedAst;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseLog = void 0;
|
|
4
4
|
exports.normalize = normalize;
|
|
5
|
+
exports.normalizeButNotDecorated = normalizeButNotDecorated;
|
|
5
6
|
exports.normalizeTreeSitter = normalizeTreeSitter;
|
|
6
7
|
const format_1 = require("./format");
|
|
7
8
|
const log_1 = require("../../../../../util/log");
|
|
@@ -11,13 +12,28 @@ const tree_sitter_normalize_1 = require("../../../tree-sitter/tree-sitter-normal
|
|
|
11
12
|
exports.parseLog = log_1.log.getSubLogger({ name: 'ast-parser' });
|
|
12
13
|
/**
|
|
13
14
|
* Take the output as produced by the parse step and normalize the AST from the R parser.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link normalizeButNotDecorated} for a version that does not decorate the AST
|
|
17
|
+
* @see {@link normalizeTreeSitter} for a version that normalizes the AST from the TreeSitter parser
|
|
14
18
|
*/
|
|
15
|
-
function normalize(
|
|
19
|
+
function normalize(parsed, getId = (0, decorate_1.deterministicCountingIdGenerator)(0), file) {
|
|
20
|
+
return (0, decorate_1.decorateAst)(normalizeButNotDecorated(parsed), { getId, file });
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Take the output as produced by the parse step and normalize the AST from the R parser.
|
|
24
|
+
* For additional decoration with ${@link decorateAst} use {@link normalize}.
|
|
25
|
+
*/
|
|
26
|
+
function normalizeButNotDecorated({ parsed }) {
|
|
16
27
|
const data = { currentRange: undefined, currentLexeme: undefined };
|
|
17
28
|
const object = (0, format_1.convertPreparedParsedData)((0, format_1.prepareParsedData)(parsed));
|
|
18
|
-
return (0,
|
|
29
|
+
return (0, normalize_root_1.normalizeRootObjToAst)(data, object);
|
|
19
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Tree-Sitter pendant to {@link normalize}.
|
|
33
|
+
*/
|
|
20
34
|
function normalizeTreeSitter({ parsed }, getId = (0, decorate_1.deterministicCountingIdGenerator)(0), file) {
|
|
21
|
-
|
|
35
|
+
const result = (0, decorate_1.decorateAst)((0, tree_sitter_normalize_1.normalizeTreeSitterTreeToAst)(parsed), { getId, file });
|
|
36
|
+
result.hasError = parsed.rootNode.hasError;
|
|
37
|
+
return result;
|
|
22
38
|
}
|
|
23
39
|
//# sourceMappingURL=parser.js.map
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
2
|
import type { RExpressionList } from '../../../../model/nodes/r-expression-list';
|
|
3
3
|
import type { JsonEntry } from '../../../json/format';
|
|
4
|
+
/**
|
|
5
|
+
* Takes the parse dta as object and produces an undecorated, normalized AST.
|
|
6
|
+
*/
|
|
4
7
|
export declare function normalizeRootObjToAst(data: NormalizerData, obj: JsonEntry): RExpressionList;
|
|
@@ -6,6 +6,9 @@ const normalize_expressions_1 = require("./normalize-expressions");
|
|
|
6
6
|
const log_1 = require("../../../../../../../util/log");
|
|
7
7
|
const arrays_1 = require("../../../../../../../util/arrays");
|
|
8
8
|
const type_1 = require("../../../../model/type");
|
|
9
|
+
/**
|
|
10
|
+
* Takes the parse dta as object and produces an undecorated, normalized AST.
|
|
11
|
+
*/
|
|
9
12
|
function normalizeRootObjToAst(data, obj) {
|
|
10
13
|
const exprContent = obj.token;
|
|
11
14
|
(0, normalize_meta_1.assureTokenType)(exprContent, type_1.RawRType.ExpressionList);
|
|
@@ -13,6 +13,7 @@ export declare class TreeSitterExecutor implements SyncParser<Parser.Tree> {
|
|
|
13
13
|
static initTreeSitter(): Promise<void>;
|
|
14
14
|
constructor();
|
|
15
15
|
rVersion(): Promise<string | 'unknown' | 'none'>;
|
|
16
|
+
treeSitterVersion(): number;
|
|
16
17
|
parse(request: RParseRequest): Parser.Tree;
|
|
17
18
|
close(): void;
|
|
18
19
|
}
|
|
@@ -18,7 +18,12 @@ function normalizeTreeSitterTreeToAst(tree) {
|
|
|
18
18
|
return root;
|
|
19
19
|
}
|
|
20
20
|
function nonErrorChildren(node) {
|
|
21
|
-
|
|
21
|
+
if (node.hasError) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return node.children;
|
|
26
|
+
}
|
|
22
27
|
}
|
|
23
28
|
function convertTreeNode(node) {
|
|
24
29
|
// generally, the grammar source file dictates what children a node has in what order:
|
package/r-bridge/parser.d.ts
CHANGED
|
@@ -27,6 +27,16 @@ export interface ParseRequiredInput<T> {
|
|
|
27
27
|
export interface ParseStepOutput<T> {
|
|
28
28
|
/** The parsed AST of the R code as given by the R parse side */
|
|
29
29
|
readonly parsed: T;
|
|
30
|
+
/** Additional meta information about the parse */
|
|
31
|
+
readonly '.parse-meta'?: {
|
|
32
|
+
/** The number of tokens in the AST */
|
|
33
|
+
readonly tokenCount: number;
|
|
34
|
+
};
|
|
30
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Takes an input program and parses it using the given parser.
|
|
38
|
+
* @param _results - just a proxy for the pipeline, signifies that this function does not need prior knowledge of the pipeline
|
|
39
|
+
* @param input - the input to the parse step
|
|
40
|
+
*/
|
|
31
41
|
export declare function parseRequests<T extends KnownParserType>(_results: unknown, input: Partial<ParseRequiredInput<T>>): Promise<ParseStepOutput<T>>;
|
|
32
42
|
export {};
|
package/r-bridge/parser.js
CHANGED
|
@@ -1,14 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseRequests = parseRequests;
|
|
4
|
+
function countChildren(node) {
|
|
5
|
+
let ret = 1;
|
|
6
|
+
for (const child of node.children) {
|
|
7
|
+
ret += countChildren(child);
|
|
8
|
+
}
|
|
9
|
+
return ret;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Takes an input program and parses it using the given parser.
|
|
13
|
+
* @param _results - just a proxy for the pipeline, signifies that this function does not need prior knowledge of the pipeline
|
|
14
|
+
* @param input - the input to the parse step
|
|
15
|
+
*/
|
|
4
16
|
async function parseRequests(_results, input) {
|
|
5
17
|
/* in the future, we want to expose all cases */
|
|
6
18
|
const request = (Array.isArray(input.request) ? input.request[0] : input.request);
|
|
7
19
|
if (input.parser?.async) {
|
|
8
|
-
|
|
20
|
+
const parsed = await input.parser.parse(request);
|
|
21
|
+
return {
|
|
22
|
+
parsed,
|
|
23
|
+
'.parse-meta': typeof parsed === 'object' && 'rootNode' in parsed ? {
|
|
24
|
+
tokenCount: countChildren(parsed.rootNode),
|
|
25
|
+
} : undefined
|
|
26
|
+
};
|
|
9
27
|
}
|
|
10
28
|
else {
|
|
11
|
-
|
|
29
|
+
const parsed = input.parser.parse(request);
|
|
30
|
+
return {
|
|
31
|
+
parsed,
|
|
32
|
+
'.parse-meta': typeof parsed === 'object' && 'rootNode' in parsed ? {
|
|
33
|
+
tokenCount: countChildren(parsed.rootNode),
|
|
34
|
+
} : undefined
|
|
35
|
+
};
|
|
12
36
|
}
|
|
13
37
|
}
|
|
14
38
|
//# sourceMappingURL=parser.js.map
|
package/r-bridge/shell.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -349,7 +359,7 @@ class RShellSession {
|
|
|
349
359
|
try {
|
|
350
360
|
fs_1.default.rmSync(f, { recursive: true, force: true });
|
|
351
361
|
}
|
|
352
|
-
catch
|
|
362
|
+
catch {
|
|
353
363
|
log_1.log.error(`failed to unlink file ${f}`);
|
|
354
364
|
}
|
|
355
365
|
}
|
|
@@ -111,7 +111,6 @@ export declare const Q: {
|
|
|
111
111
|
readonly id: (id: NodeId) => FlowrSearchBuilder<"get">;
|
|
112
112
|
};
|
|
113
113
|
export type FlowrSearchBuilderType<Generator extends GeneratorNames = GeneratorNames, Transformers extends TransformerNames[] = TransformerNames[], Info = ParentInformation, ElementType = FlowrSearchElements<Info, FlowrSearchElement<Info>[]>> = FlowrSearchBuilder<Generator, Transformers, Info, ElementType>;
|
|
114
|
-
type GetElements<F> = F extends FlowrSearchElements<infer Info, infer Elements> ? Elements extends FlowrSearchElement<Info>[] ? Elements : never : never;
|
|
115
114
|
/**
|
|
116
115
|
* The search query is a combination of a generator and a list of transformers
|
|
117
116
|
* and allows this view to pass such queries in a serialized form.
|
|
@@ -172,7 +171,7 @@ export declare class FlowrSearchBuilder<Generator extends GeneratorNames, Transf
|
|
|
172
171
|
/**
|
|
173
172
|
* merge combines the search results with those of another search.
|
|
174
173
|
*/
|
|
175
|
-
merge<Generator2 extends GeneratorNames, Transformers2 extends TransformerNames[], OtherElementType extends FlowrSearchElements<Info, FlowrSearchElement<Info>[]>>(other: FlowrSearchBuilder<Generator2, Transformers2, Info, OtherElementType>): FlowrSearchBuilder<Generator, Transformers, Info
|
|
174
|
+
merge<Generator2 extends GeneratorNames, Transformers2 extends TransformerNames[], OtherElementType extends FlowrSearchElements<Info, FlowrSearchElement<Info>[]>>(other: FlowrSearchBuilder<Generator2, Transformers2, Info, OtherElementType>): FlowrSearchBuilder<Generator, Transformers, Info>;
|
|
176
175
|
/**
|
|
177
176
|
* Construct the final search (this may happen automatically with most search handlers).
|
|
178
177
|
*
|
|
@@ -161,9 +161,7 @@ class FlowrSearchBuilder {
|
|
|
161
161
|
/**
|
|
162
162
|
* merge combines the search results with those of another search.
|
|
163
163
|
*/
|
|
164
|
-
merge(other /* | FlowrSearch<Info, Generator2, Transformers2, OtherElementType> */
|
|
165
|
-
// @ts-expect-error -- this works when merging, there is no info disparity
|
|
166
|
-
) {
|
|
164
|
+
merge(other /* | FlowrSearch<Info, Generator2, Transformers2, OtherElementType> */) {
|
|
167
165
|
this.search.push({ type: 'transformer', name: 'merge', args: { generator: other.generator, search: other.search } });
|
|
168
166
|
return this;
|
|
169
167
|
}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.comments = exports.initialCommentInfo = void 0;
|
|
27
37
|
const xpath = __importStar(require("xpath-ts2"));
|
|
@@ -96,7 +96,6 @@ function retrieveFunctionCallMetaInformation(info, outputPath) {
|
|
|
96
96
|
console.log(` [${(0, time_1.date2string)(new Date())}] Used functions metadata reading completed, summarizing and writing to file`);
|
|
97
97
|
writeFunctionCallsMetaInformationToCsv(outputPath, data);
|
|
98
98
|
for (const [index, arg] of data.args.entries()) {
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
100
99
|
if (!arg) {
|
|
101
100
|
// we treat the first/0-argument entry separate for legacy reasons
|
|
102
101
|
continue;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.usedPackages = exports.initialUsedPackageInfos = void 0;
|
|
27
37
|
const xpath = __importStar(require("xpath-ts2"));
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.values = void 0;
|
|
27
37
|
const xpath = __importStar(require("xpath-ts2"));
|
|
@@ -88,7 +88,7 @@ class StatisticsSummarizer extends summarizer_1.Summarizer {
|
|
|
88
88
|
try {
|
|
89
89
|
fs_1.default.rmSync(path, { recursive: true, force: true });
|
|
90
90
|
}
|
|
91
|
-
catch
|
|
91
|
+
catch {
|
|
92
92
|
log_1.log.error('failure in cleanup');
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -122,7 +122,6 @@ class StatisticsSummarizer extends summarizer_1.Summarizer {
|
|
|
122
122
|
this.log(`Found ${count} files to summarize`);
|
|
123
123
|
return Promise.resolve();
|
|
124
124
|
}
|
|
125
|
-
// eslint-disable-next-line @typescript-eslint/require-await -- just to obey the structure
|
|
126
125
|
async summarizePhase() {
|
|
127
126
|
// detect all subfolders in the current folder (default, test...) for each: concat.
|
|
128
127
|
this.removeIfExists(this.config.outputPath);
|
package/util/files.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
package/util/json.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// to get the types within JSON.stringify
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
4
|
exports.jsonReplacer = jsonReplacer;
|
|
6
5
|
exports.jsonBigIntRetriever = jsonBigIntRetriever;
|
|
@@ -11,7 +10,6 @@ function jsonReplacer(key, value) {
|
|
|
11
10
|
return undefined;
|
|
12
11
|
}
|
|
13
12
|
else if (value instanceof Map || value instanceof Set) {
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
15
13
|
return [...value];
|
|
16
14
|
}
|
|
17
15
|
else if (typeof value === 'bigint') {
|
package/util/mermaid/dfg.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ interface MermaidGraph {
|
|
|
18
18
|
/** in the form of from-\>to because I am lazy, see {@link encodeEdge} */
|
|
19
19
|
presentEdges: Set<string>;
|
|
20
20
|
rootGraph: DataflowGraph;
|
|
21
|
+
/** if given, the dataflow graph will only focus on the "important" parts */
|
|
22
|
+
simplified?: boolean;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
* Prints a {@link SourceRange|range} as a human readable string.
|
|
@@ -33,6 +35,7 @@ interface MermaidGraphConfiguration {
|
|
|
33
35
|
markStyle?: MermaidMarkStyle;
|
|
34
36
|
rootGraph?: DataflowGraph;
|
|
35
37
|
presentEdges?: Set<string>;
|
|
38
|
+
simplified?: boolean;
|
|
36
39
|
}
|
|
37
40
|
export declare function graphToMermaid(config: MermaidGraphConfiguration): {
|
|
38
41
|
string: string;
|
package/util/mermaid/dfg.js
CHANGED
|
@@ -37,14 +37,24 @@ function subflowToMermaid(nodeId, exitPoints, subflow, mermaid, idPrefix = '') {
|
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
const subflowId = `${idPrefix}flow-${nodeId}`;
|
|
40
|
-
mermaid.
|
|
40
|
+
if (mermaid.simplified) {
|
|
41
|
+
// get parent
|
|
42
|
+
const idMap = mermaid.rootGraph.idMap;
|
|
43
|
+
const node = idMap?.get(nodeId);
|
|
44
|
+
const nodeLexeme = node?.info.fullLexeme ?? node?.lexeme ?? '??';
|
|
45
|
+
mermaid.nodeLines.push(`\nsubgraph "${subflowId}" ["${(0, mermaid_1.escapeMarkdown)(nodeLexeme ?? 'function')}"]`);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
mermaid.nodeLines.push(`\nsubgraph "${subflowId}" [function ${nodeId}]`);
|
|
49
|
+
}
|
|
41
50
|
const subgraph = graphToMermaidGraph(subflow.graph, {
|
|
42
51
|
graph: mermaid.rootGraph,
|
|
43
52
|
rootGraph: mermaid.rootGraph,
|
|
44
53
|
idPrefix,
|
|
45
54
|
includeEnvironments: mermaid.includeEnvironments,
|
|
46
55
|
mark: mermaid.mark,
|
|
47
|
-
prefix: null
|
|
56
|
+
prefix: null,
|
|
57
|
+
simplified: mermaid.simplified
|
|
48
58
|
});
|
|
49
59
|
mermaid.nodeLines.push(...subgraph.nodeLines);
|
|
50
60
|
mermaid.edgeLines.push(...subgraph.edgeLines);
|
|
@@ -143,10 +153,16 @@ function vertexToMermaid(info, mermaid, id, idPrefix, mark) {
|
|
|
143
153
|
}
|
|
144
154
|
const node = mermaid.rootGraph.idMap?.get(info.id);
|
|
145
155
|
const lexeme = node?.lexeme ?? (node?.type === type_1.RType.ExpressionList ? node?.grouping?.[0]?.lexeme : '') ?? '??';
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
156
|
+
if (mermaid.simplified) {
|
|
157
|
+
const escapedName = '**' + (0, mermaid_1.escapeMarkdown)(node ? `${lexeme}` : '??') + '**' + (node ? `\n*${node.type}*` : '');
|
|
158
|
+
mermaid.nodeLines.push(` ${idPrefix}${id}${open}"\`${escapedName}\`"${close}`);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
const escapedName = (0, mermaid_1.escapeMarkdown)(node ? `[${node.type}] ${lexeme}` : '??');
|
|
162
|
+
const deps = info.controlDependencies ? ', :may:' + info.controlDependencies.map(c => c.id + (c.when ? '+' : '-')).join(',') : '';
|
|
163
|
+
const n = node?.info.fullRange ?? node?.location ?? (node?.type === type_1.RType.ExpressionList ? node?.grouping?.[0].location : undefined);
|
|
164
|
+
mermaid.nodeLines.push(` ${idPrefix}${id}${open}"\`${escapedName}${escapedName.length > 10 ? '\n ' : ' '}(${id}${deps})\n *${formatRange(n)}*${fCall ? displayFunctionArgMapping(info.args) : ''}\`"${close}`);
|
|
165
|
+
}
|
|
150
166
|
if (mark?.has(id)) {
|
|
151
167
|
mermaid.nodeLines.push(` style ${idPrefix}${id} ${mermaid.markStyle.vertex} `);
|
|
152
168
|
}
|
|
@@ -176,8 +192,8 @@ function vertexToMermaid(info, mermaid, id, idPrefix, mark) {
|
|
|
176
192
|
}
|
|
177
193
|
}
|
|
178
194
|
// make the passing of root ids more performant again
|
|
179
|
-
function graphToMermaidGraph(rootIds, { graph, prefix = 'flowchart TD', idPrefix = '', includeEnvironments =
|
|
180
|
-
const mermaid = { nodeLines: prefix === null ? [] : [prefix], edgeLines: [], presentEdges, mark, rootGraph: rootGraph ?? graph, includeEnvironments, markStyle };
|
|
195
|
+
function graphToMermaidGraph(rootIds, { simplified, graph, prefix = 'flowchart TD', idPrefix = '', includeEnvironments = !simplified, mark, rootGraph, presentEdges = new Set(), markStyle = { vertex: 'stroke:teal,stroke-width:7px,stroke-opacity:.8;', edge: 'stroke:teal,stroke-width:4.2px,stroke-opacity:.8' } }) {
|
|
196
|
+
const mermaid = { nodeLines: prefix === null ? [] : [prefix], edgeLines: [], presentEdges, mark, rootGraph: rootGraph ?? graph, includeEnvironments, markStyle, simplified };
|
|
181
197
|
for (const [id, info] of graph.vertices(true)) {
|
|
182
198
|
if (rootIds.has(id)) {
|
|
183
199
|
vertexToMermaid(info, mermaid, id, idPrefix, mark);
|
package/util/numbers.d.ts
CHANGED
package/util/numbers.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.bigint2number = bigint2number;
|
|
4
|
+
exports.roundToDecimals = roundToDecimals;
|
|
4
5
|
function bigint2number(a) {
|
|
5
6
|
// we have to remove the trailing `n`
|
|
6
7
|
return Number(String(a).slice(0, -1));
|
|
7
8
|
}
|
|
9
|
+
function roundToDecimals(value, decimals) {
|
|
10
|
+
const factor = 10 ** decimals;
|
|
11
|
+
return Math.round(value * factor) / factor;
|
|
12
|
+
}
|
|
8
13
|
//# sourceMappingURL=numbers.js.map
|
package/util/parallel.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.LimitedThreadPool = void 0;
|
|
27
37
|
/**
|