@eagleoutice/flowr 2.0.11 → 2.0.12
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 +41 -8
- package/abstract-interpretation/domain.d.ts +33 -3
- package/abstract-interpretation/domain.js +31 -1
- package/benchmark/slicer.d.ts +3 -0
- package/benchmark/slicer.js +3 -0
- package/benchmark/stats/print.js +0 -1
- package/benchmark/summarizer/second-phase/graph.js +4 -4
- package/cli/flowr.d.ts +9 -8
- package/cli/flowr.js +22 -14
- package/cli/repl/core.d.ts +28 -12
- package/cli/repl/core.js +18 -18
- package/cli/repl/server/connection.d.ts +2 -1
- package/cli/repl/server/connection.js +61 -18
- package/cli/repl/server/messages/analysis.d.ts +11 -5
- package/cli/repl/server/messages/analysis.js +1 -1
- package/cli/repl/server/server.d.ts +2 -1
- package/cli/repl/server/server.js +4 -2
- package/core/steps/all/core/00-parse.d.ts +3 -3
- package/core/steps/all/core/00-parse.js +7 -1
- package/core/steps/all/core/20-dataflow.d.ts +2 -2
- package/core/steps/pipeline/default-pipelines.d.ts +8 -8
- package/dataflow/environments/built-in.js +1 -1
- package/dataflow/extractor.d.ts +2 -2
- package/dataflow/extractor.js +20 -4
- package/dataflow/info.d.ts +9 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +8 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +25 -4
- package/dataflow/processor.d.ts +5 -4
- package/dataflow/processor.js +3 -2
- package/package.json +7 -5
- package/r-bridge/data/types.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +5 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-repeat.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-repeat.js +2 -2
- package/r-bridge/retriever.d.ts +24 -16
- package/r-bridge/retriever.js +19 -8
- package/slicing/criterion/parse.js +4 -4
- package/util/version.js +1 -1
|
@@ -26,6 +26,7 @@ export type IdGenerator<OtherInfo> = (data: RNode<OtherInfo>) => NodeId;
|
|
|
26
26
|
* The simplest id generator which just increments a number on each call.
|
|
27
27
|
*/
|
|
28
28
|
export declare function deterministicCountingIdGenerator(id?: number): () => NodeId;
|
|
29
|
+
export declare function deterministicPrefixIdGenerator(prefix: string, id?: number): () => NodeId;
|
|
29
30
|
export declare function sourcedDeterministicCountingIdGenerator(path: string, location: SourceRange, start?: number): () => NodeId;
|
|
30
31
|
/**
|
|
31
32
|
* Generates the location id, used by {@link deterministicLocationIdGenerator}.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.decorateAst = exports.deterministicLocationIdGenerator = exports.nodeToLocationId = exports.sourcedDeterministicCountingIdGenerator = exports.deterministicCountingIdGenerator = void 0;
|
|
13
|
+
exports.decorateAst = exports.deterministicLocationIdGenerator = exports.nodeToLocationId = exports.sourcedDeterministicCountingIdGenerator = exports.deterministicPrefixIdGenerator = exports.deterministicCountingIdGenerator = void 0;
|
|
14
14
|
const assert_1 = require("../../../../../util/assert");
|
|
15
15
|
const bimap_1 = require("../../../../../util/bimap");
|
|
16
16
|
const stateful_fold_1 = require("./stateful-fold");
|
|
@@ -22,6 +22,10 @@ function deterministicCountingIdGenerator(id = 0) {
|
|
|
22
22
|
return () => id++;
|
|
23
23
|
}
|
|
24
24
|
exports.deterministicCountingIdGenerator = deterministicCountingIdGenerator;
|
|
25
|
+
function deterministicPrefixIdGenerator(prefix, id = 0) {
|
|
26
|
+
return () => `${prefix}-${id++}`;
|
|
27
|
+
}
|
|
28
|
+
exports.deterministicPrefixIdGenerator = deterministicPrefixIdGenerator;
|
|
25
29
|
function sourcedDeterministicCountingIdGenerator(path, location, start = 0) {
|
|
26
30
|
let id = start;
|
|
27
31
|
return () => `${path}-${loc2Id(location)}-${id++}`;
|
|
@@ -4,9 +4,9 @@ import type { RRepeatLoop } from '../../../../model/nodes/r-repeat-loop';
|
|
|
4
4
|
/**
|
|
5
5
|
* Try to parse the construct as a {@link RRepeatLoop}.
|
|
6
6
|
*
|
|
7
|
-
* @param data
|
|
7
|
+
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
8
8
|
* @param repeatToken - Token which represents the `repeat` keyword
|
|
9
|
-
* @param bodyToken
|
|
9
|
+
* @param bodyToken - The `body` of the repeat-loop
|
|
10
10
|
*
|
|
11
11
|
* @returns The parsed {@link RRepeatLoop} or `undefined` if the given construct is not a repeat-loop
|
|
12
12
|
*/
|
|
@@ -8,9 +8,9 @@ const normalize_single_node_1 = require("../structure/normalize-single-node");
|
|
|
8
8
|
/**
|
|
9
9
|
* Try to parse the construct as a {@link RRepeatLoop}.
|
|
10
10
|
*
|
|
11
|
-
* @param data
|
|
11
|
+
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
12
12
|
* @param repeatToken - Token which represents the `repeat` keyword
|
|
13
|
-
* @param bodyToken
|
|
13
|
+
* @param bodyToken - The `body` of the repeat-loop
|
|
14
14
|
*
|
|
15
15
|
* @returns The parsed {@link RRepeatLoop} or `undefined` if the given construct is not a repeat-loop
|
|
16
16
|
*/
|
package/r-bridge/retriever.d.ts
CHANGED
|
@@ -5,45 +5,53 @@ import type { NormalizedAst } from './lang-4.x/ast/model/processing/decorate';
|
|
|
5
5
|
export declare const fileProtocol = "file://";
|
|
6
6
|
export interface RParseRequestFromFile {
|
|
7
7
|
readonly request: 'file';
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* The path to the file (an absolute path is probably best here).
|
|
10
|
+
* See {@link RParseRequests} for multiple files.
|
|
11
|
+
*/
|
|
9
12
|
readonly content: string;
|
|
10
13
|
}
|
|
11
14
|
export interface RParseRequestFromText {
|
|
12
15
|
readonly request: 'text';
|
|
16
|
+
/**
|
|
17
|
+
* Source code to parse (not a file path).
|
|
18
|
+
* If you want to parse multiple files as one, either use {@link RParseRequests},
|
|
19
|
+
* a higher request as a {@link FileAnalysisRequestMessage},
|
|
20
|
+
* or concatenate their contents to pass them with this request.
|
|
21
|
+
*/
|
|
13
22
|
readonly content: string;
|
|
14
23
|
}
|
|
15
24
|
/**
|
|
16
|
-
* A provider for an {@link
|
|
25
|
+
* A provider for an {@link RParseRequests} that can be used, for example, to override source file parsing behavior in tests
|
|
17
26
|
*/
|
|
18
27
|
export interface RParseRequestProvider {
|
|
19
28
|
createRequest(path: string): RParseRequest;
|
|
20
29
|
}
|
|
30
|
+
export type RParseRequest = RParseRequestFromFile | RParseRequestFromText;
|
|
21
31
|
/**
|
|
22
|
-
*
|
|
32
|
+
* Several requests that can be passed along to {@link retrieveParseDataFromRCode}.
|
|
23
33
|
*/
|
|
24
|
-
export type
|
|
34
|
+
export type RParseRequests = RParseRequest | ReadonlyArray<RParseRequest>;
|
|
25
35
|
export declare function requestFromInput(input: `${typeof fileProtocol}${string}`): RParseRequestFromFile;
|
|
36
|
+
export declare function requestFromInput(input: `${typeof fileProtocol}${string}`[]): RParseRequestFromFile[];
|
|
26
37
|
export declare function requestFromInput(input: string): RParseRequestFromText;
|
|
38
|
+
export declare function requestFromInput(input: readonly string[]): RParseRequests;
|
|
27
39
|
export declare function requestProviderFromFile(): RParseRequestProvider;
|
|
28
|
-
export declare function requestProviderFromText(text: {
|
|
40
|
+
export declare function requestProviderFromText(text: Readonly<{
|
|
29
41
|
[path: string]: string;
|
|
30
|
-
}): RParseRequestProvider;
|
|
42
|
+
}>): RParseRequestProvider;
|
|
31
43
|
export declare function requestFingerprint(request: RParseRequest): string;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* Throws if the file could not be parsed.
|
|
37
|
-
* If successful, allows to further query the last result with {@link retrieveNumberOfRTokensOfLastParse}.
|
|
38
|
-
*/
|
|
39
|
-
export declare function retrieveParseDataFromRCode(request: RParseRequest, shell: (RShell | RShellExecutor)): AsyncOrSync<string>;
|
|
44
|
+
export declare function isEmptyRequest(request: RParseRequest): boolean;
|
|
45
|
+
export declare function retrieveParseDataFromRCode(request: RParseRequest, shell: RShell): Promise<string>;
|
|
46
|
+
export declare function retrieveParseDataFromRCode(request: RParseRequest, shell: RShellExecutor): string;
|
|
47
|
+
export declare function retrieveParseDataFromRCode(request: RParseRequest, shell: RShell | RShellExecutor): AsyncOrSync<string>;
|
|
40
48
|
/**
|
|
41
49
|
* Uses {@link retrieveParseDataFromRCode} and returns the nicely formatted object-AST.
|
|
42
|
-
* If successful, allows
|
|
50
|
+
* If successful, allows further querying the last result with {@link retrieveNumberOfRTokensOfLastParse}.
|
|
43
51
|
*/
|
|
44
52
|
export declare function retrieveNormalizedAstFromRCode(request: RParseRequest, shell: RShell): Promise<NormalizedAst>;
|
|
45
53
|
/**
|
|
46
|
-
* If the string has (R-)quotes around it, they will be removed
|
|
54
|
+
* If the string has (R-)quotes around it, they will be removed; otherwise the string is returned unchanged.
|
|
47
55
|
*/
|
|
48
56
|
export declare function removeRQuotes(str: string): string;
|
|
49
57
|
/**
|
package/r-bridge/retriever.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.retrieveNumberOfRTokensOfLastParse = exports.removeRQuotes = exports.retrieveNormalizedAstFromRCode = exports.retrieveParseDataFromRCode = exports.requestFingerprint = exports.requestProviderFromText = exports.requestProviderFromFile = exports.requestFromInput = exports.fileProtocol = void 0;
|
|
6
|
+
exports.retrieveNumberOfRTokensOfLastParse = exports.removeRQuotes = exports.retrieveNormalizedAstFromRCode = exports.retrieveParseDataFromRCode = exports.isEmptyRequest = exports.requestFingerprint = exports.requestProviderFromText = exports.requestProviderFromFile = exports.requestFromInput = exports.fileProtocol = void 0;
|
|
7
7
|
const strings_1 = require("../util/strings");
|
|
8
8
|
const assert_1 = require("../util/assert");
|
|
9
9
|
const shell_executor_1 = require("./shell-executor");
|
|
@@ -13,13 +13,20 @@ const init_1 = require("./init");
|
|
|
13
13
|
const convert_values_1 = require("./lang-4.x/convert-values");
|
|
14
14
|
exports.fileProtocol = 'file://';
|
|
15
15
|
/**
|
|
16
|
-
* Creates a {@link
|
|
16
|
+
* Creates a {@link RParseRequests} from a given input.
|
|
17
|
+
* If your input starts with {@link fileProtocol}, it is assumed to be a file path and will be processed as such.
|
|
18
|
+
* Giving an array, you can mix file paths and text content (again using the {@link fileProtocol}).
|
|
19
|
+
*
|
|
17
20
|
*/
|
|
18
21
|
function requestFromInput(input) {
|
|
19
|
-
|
|
22
|
+
if (Array.isArray(input)) {
|
|
23
|
+
return input.flatMap(requestFromInput);
|
|
24
|
+
}
|
|
25
|
+
const content = input;
|
|
26
|
+
const file = content.startsWith(exports.fileProtocol);
|
|
20
27
|
return {
|
|
21
28
|
request: file ? 'file' : 'text',
|
|
22
|
-
content: file ?
|
|
29
|
+
content: file ? content.slice(7) : content
|
|
23
30
|
};
|
|
24
31
|
}
|
|
25
32
|
exports.requestFromInput = requestFromInput;
|
|
@@ -49,15 +56,19 @@ function requestFingerprint(request) {
|
|
|
49
56
|
return (0, object_hash_1.default)(request);
|
|
50
57
|
}
|
|
51
58
|
exports.requestFingerprint = requestFingerprint;
|
|
59
|
+
function isEmptyRequest(request) {
|
|
60
|
+
return request.content.trim().length === 0;
|
|
61
|
+
}
|
|
62
|
+
exports.isEmptyRequest = isEmptyRequest;
|
|
52
63
|
/**
|
|
53
64
|
* Provides the capability to parse R files/R code using the R parser.
|
|
54
65
|
* Depends on {@link RShell} to provide a connection to R.
|
|
55
66
|
* <p>
|
|
56
67
|
* Throws if the file could not be parsed.
|
|
57
|
-
* If successful, allows
|
|
68
|
+
* If successful, allows further querying the last result with {@link retrieveNumberOfRTokensOfLastParse}.
|
|
58
69
|
*/
|
|
59
70
|
function retrieveParseDataFromRCode(request, shell) {
|
|
60
|
-
if (request
|
|
71
|
+
if (isEmptyRequest(request)) {
|
|
61
72
|
return Promise.resolve('');
|
|
62
73
|
}
|
|
63
74
|
const suffix = request.request === 'file' ? ', encoding="utf-8"' : '';
|
|
@@ -73,7 +84,7 @@ function retrieveParseDataFromRCode(request, shell) {
|
|
|
73
84
|
exports.retrieveParseDataFromRCode = retrieveParseDataFromRCode;
|
|
74
85
|
/**
|
|
75
86
|
* Uses {@link retrieveParseDataFromRCode} and returns the nicely formatted object-AST.
|
|
76
|
-
* If successful, allows
|
|
87
|
+
* If successful, allows further querying the last result with {@link retrieveNumberOfRTokensOfLastParse}.
|
|
77
88
|
*/
|
|
78
89
|
async function retrieveNormalizedAstFromRCode(request, shell) {
|
|
79
90
|
const data = await retrieveParseDataFromRCode(request, shell);
|
|
@@ -81,7 +92,7 @@ async function retrieveNormalizedAstFromRCode(request, shell) {
|
|
|
81
92
|
}
|
|
82
93
|
exports.retrieveNormalizedAstFromRCode = retrieveNormalizedAstFromRCode;
|
|
83
94
|
/**
|
|
84
|
-
* If the string has (R-)quotes around it, they will be removed
|
|
95
|
+
* If the string has (R-)quotes around it, they will be removed; otherwise the string is returned unchanged.
|
|
85
96
|
*/
|
|
86
97
|
function removeRQuotes(str) {
|
|
87
98
|
if (str.length > 1 && ((0, strings_1.startAndEndsWith)(str, '\'') || (0, strings_1.startAndEndsWith)(str, '"'))) {
|
|
@@ -19,7 +19,10 @@ exports.CriteriaParseError = CriteriaParseError;
|
|
|
19
19
|
*/
|
|
20
20
|
function slicingCriterionToId(criterion, decorated) {
|
|
21
21
|
let resolved;
|
|
22
|
-
if (criterion.
|
|
22
|
+
if (criterion.startsWith('$')) {
|
|
23
|
+
resolved = (0, node_id_1.normalizeIdToNumberIfPossible)(criterion.substring(1));
|
|
24
|
+
}
|
|
25
|
+
else if (criterion.includes(':')) {
|
|
23
26
|
const [line, column] = criterion.split(':').map(c => parseInt(c));
|
|
24
27
|
resolved = locationToId([line, column], decorated.idMap);
|
|
25
28
|
}
|
|
@@ -27,9 +30,6 @@ function slicingCriterionToId(criterion, decorated) {
|
|
|
27
30
|
const [line, name] = criterion.split(/@(.*)/s); // only split at first occurrence
|
|
28
31
|
resolved = conventionalCriteriaToId(parseInt(line), name, decorated.idMap);
|
|
29
32
|
}
|
|
30
|
-
else if (criterion.startsWith('$')) {
|
|
31
|
-
resolved = (0, node_id_1.normalizeIdToNumberIfPossible)(criterion.substring(1));
|
|
32
|
-
}
|
|
33
33
|
if (resolved === undefined) {
|
|
34
34
|
throw new CriteriaParseError(`invalid slicing criterion ${criterion}`);
|
|
35
35
|
}
|
package/util/version.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.flowrVersion = void 0;
|
|
4
4
|
const semver_1 = require("semver");
|
|
5
5
|
// this is automatically replaced with the current version by release-it
|
|
6
|
-
const version = '2.0.
|
|
6
|
+
const version = '2.0.12';
|
|
7
7
|
function flowrVersion() {
|
|
8
8
|
return new semver_1.SemVer(version);
|
|
9
9
|
}
|