@eagleoutice/flowr 2.2.14 → 2.2.16
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 +210 -6
- package/benchmark/slicer.d.ts +3 -1
- package/benchmark/slicer.js +8 -5
- package/benchmark/summarizer/first-phase/process.d.ts +2 -1
- package/benchmark/summarizer/first-phase/process.js +2 -2
- package/cli/benchmark-app.d.ts +1 -0
- package/cli/benchmark-app.js +4 -1
- package/cli/benchmark-helper-app.d.ts +1 -0
- package/cli/benchmark-helper-app.js +7 -8
- package/cli/common/options.js +2 -0
- package/cli/export-quads-app.js +2 -1
- package/cli/flowr.js +58 -57
- package/cli/repl/commands/repl-cfg.js +13 -13
- package/cli/repl/commands/repl-commands.js +3 -3
- package/cli/repl/commands/repl-dataflow.js +10 -10
- package/cli/repl/commands/repl-execute.d.ts +2 -3
- package/cli/repl/commands/repl-execute.js +5 -4
- package/cli/repl/commands/repl-lineage.js +4 -4
- package/cli/repl/commands/repl-main.d.ts +12 -1
- package/cli/repl/commands/repl-normalize.js +6 -6
- package/cli/repl/commands/repl-parse.js +2 -2
- package/cli/repl/commands/repl-query.js +9 -9
- package/cli/repl/commands/repl-version.js +1 -1
- package/cli/repl/core.d.ts +5 -2
- package/cli/repl/core.js +10 -8
- package/cli/repl/server/connection.d.ts +3 -1
- package/cli/repl/server/connection.js +7 -5
- package/cli/repl/server/server.d.ts +3 -2
- package/cli/repl/server/server.js +4 -2
- package/cli/script-core/statistics-core.d.ts +2 -1
- package/cli/script-core/statistics-core.js +2 -2
- package/cli/script-core/statistics-helper-core.d.ts +2 -1
- package/cli/script-core/statistics-helper-core.js +5 -4
- package/cli/slicer-app.js +4 -2
- package/cli/statistics-app.js +2 -1
- package/cli/statistics-helper-app.js +2 -1
- package/config.d.ts +12 -10
- package/config.js +27 -43
- package/control-flow/basic-cfg-guided-visitor.d.ts +3 -3
- package/control-flow/cfg-dead-code.d.ts +4 -0
- package/control-flow/cfg-dead-code.js +124 -0
- package/control-flow/cfg-simplification.d.ts +19 -6
- package/control-flow/cfg-simplification.js +23 -19
- package/control-flow/control-flow-graph.d.ts +3 -1
- package/control-flow/control-flow-graph.js +5 -0
- package/control-flow/dfg-cfg-guided-visitor.d.ts +9 -7
- package/control-flow/dfg-cfg-guided-visitor.js +16 -5
- package/control-flow/extract-cfg.d.ts +4 -2
- package/control-flow/extract-cfg.js +63 -59
- package/control-flow/semantic-cfg-guided-visitor.d.ts +36 -9
- package/control-flow/semantic-cfg-guided-visitor.js +73 -20
- package/control-flow/simple-visitor.d.ts +4 -0
- package/control-flow/simple-visitor.js +14 -0
- package/control-flow/syntax-cfg-guided-visitor.d.ts +2 -2
- package/core/pipeline-executor.d.ts +4 -1
- package/core/pipeline-executor.js +6 -5
- package/core/steps/all/core/10-normalize.d.ts +2 -0
- package/core/steps/all/core/10-normalize.js +1 -1
- package/core/steps/all/core/11-normalize-tree-sitter.d.ts +2 -1
- package/core/steps/all/core/11-normalize-tree-sitter.js +2 -2
- package/core/steps/all/core/20-dataflow.d.ts +2 -1
- package/core/steps/all/core/20-dataflow.js +2 -2
- package/core/steps/all/static-slicing/00-slice.d.ts +2 -1
- package/core/steps/all/static-slicing/00-slice.js +2 -2
- package/core/steps/pipeline/default-pipelines.d.ts +32 -31
- package/core/steps/pipeline/default-pipelines.js +8 -8
- package/core/steps/pipeline-step.d.ts +2 -1
- package/dataflow/environments/built-in-config.d.ts +4 -3
- package/dataflow/environments/built-in.d.ts +16 -1
- package/dataflow/environments/built-in.js +11 -5
- package/dataflow/environments/default-builtin-config.js +5 -3
- package/dataflow/environments/define.d.ts +2 -1
- package/dataflow/environments/define.js +4 -5
- package/dataflow/environments/remove.d.ts +6 -0
- package/dataflow/environments/remove.js +29 -0
- package/dataflow/environments/resolve-by-name.d.ts +0 -36
- package/dataflow/environments/resolve-by-name.js +0 -240
- package/dataflow/eval/resolve/alias-tracking.d.ts +92 -0
- package/dataflow/eval/resolve/alias-tracking.js +352 -0
- package/dataflow/eval/resolve/resolve-argument.d.ts +8 -0
- package/dataflow/eval/resolve/resolve-argument.js +118 -0
- package/dataflow/eval/resolve/resolve.d.ts +37 -0
- package/dataflow/eval/resolve/resolve.js +95 -0
- package/dataflow/eval/values/general.d.ts +27 -0
- package/dataflow/eval/values/general.js +73 -0
- package/dataflow/eval/values/intervals/interval-constants.d.ts +4 -0
- package/dataflow/eval/values/intervals/interval-constants.js +27 -0
- package/dataflow/eval/values/logical/logical-constants.d.ts +7 -0
- package/dataflow/eval/values/logical/logical-constants.js +31 -0
- package/dataflow/eval/values/r-value.d.ts +58 -0
- package/dataflow/eval/values/r-value.js +90 -0
- package/dataflow/eval/values/scalar/scalar-consatnts.d.ts +15 -0
- package/dataflow/eval/values/scalar/scalar-consatnts.js +35 -0
- package/dataflow/eval/values/sets/set-constants.d.ts +7 -0
- package/dataflow/eval/values/sets/set-constants.js +34 -0
- package/dataflow/eval/values/string/string-constants.d.ts +8 -0
- package/dataflow/eval/values/string/string-constants.js +45 -0
- package/dataflow/eval/values/vectors/vector-constants.d.ts +14 -0
- package/dataflow/eval/values/vectors/vector-constants.js +35 -0
- package/dataflow/extractor.d.ts +2 -1
- package/dataflow/extractor.js +2 -1
- package/dataflow/graph/unknown-replacement.d.ts +11 -0
- package/dataflow/graph/unknown-replacement.js +12 -0
- package/dataflow/graph/unknown-side-effect.d.ts +7 -0
- package/dataflow/graph/unknown-side-effect.js +13 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +5 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +8 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +4 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +15 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +20 -18
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +11 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +5 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +26 -29
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +23 -0
- package/dataflow/internal/process/functions/call/common.js +1 -1
- package/dataflow/internal/process/functions/call/known-call-handling.js +2 -1
- package/dataflow/internal/process/functions/process-parameter.js +1 -1
- package/dataflow/origin/dfg-get-symbol-refs.d.ts +21 -0
- package/dataflow/origin/dfg-get-symbol-refs.js +50 -0
- package/dataflow/processor.d.ts +5 -0
- package/documentation/doc-util/doc-cfg.js +4 -3
- package/documentation/doc-util/doc-code.d.ts +1 -1
- package/documentation/doc-util/doc-dfg.js +3 -2
- package/documentation/doc-util/doc-functions.d.ts +24 -0
- package/documentation/doc-util/doc-functions.js +65 -0
- package/documentation/doc-util/doc-normalized-ast.js +3 -2
- package/documentation/doc-util/doc-print.d.ts +5 -0
- package/documentation/doc-util/doc-print.js +36 -0
- package/documentation/doc-util/doc-query.d.ts +6 -3
- package/documentation/doc-util/doc-query.js +6 -3
- package/documentation/doc-util/doc-repl.js +2 -1
- package/documentation/doc-util/doc-search.js +3 -2
- package/documentation/doc-util/doc-types.d.ts +28 -6
- package/documentation/doc-util/doc-types.js +89 -45
- package/documentation/print-cfg-wiki.js +10 -11
- package/documentation/print-core-wiki.js +5 -5
- package/documentation/print-dataflow-graph-wiki.js +14 -13
- package/documentation/print-engines-wiki.js +2 -3
- package/documentation/print-faq-wiki.js +8 -2
- package/documentation/print-interface-wiki.js +1 -2
- package/documentation/print-linter-issue.d.ts +1 -0
- package/documentation/print-linter-issue.js +71 -0
- package/documentation/print-linter-wiki.js +219 -34
- package/documentation/print-linting-and-testing-wiki.js +2 -4
- package/documentation/print-normalized-ast-wiki.js +3 -3
- package/documentation/print-query-wiki.js +81 -2
- package/documentation/print-readme.js +24 -1
- package/documentation/print-search-wiki.js +1 -2
- package/linter/linter-executor.d.ts +3 -1
- package/linter/linter-executor.js +3 -2
- package/linter/linter-format.d.ts +67 -7
- package/linter/linter-format.js +12 -1
- package/linter/linter-rules.d.ts +155 -16
- package/linter/linter-rules.js +12 -4
- package/linter/linter-tags.d.ts +80 -0
- package/linter/linter-tags.js +85 -0
- package/linter/rules/absolute-path.d.ts +71 -0
- package/linter/rules/absolute-path.js +177 -0
- package/linter/rules/deprecated-functions.d.ts +43 -0
- package/linter/rules/deprecated-functions.js +58 -0
- package/linter/rules/{2-file-path-validity.d.ts → file-path-validity.d.ts} +16 -6
- package/linter/rules/{2-file-path-validity.js → file-path-validity.js} +21 -13
- package/linter/rules/naming-convention.d.ts +71 -0
- package/linter/rules/naming-convention.js +164 -0
- package/linter/rules/seeded-randomness.d.ts +65 -0
- package/linter/rules/seeded-randomness.js +122 -0
- package/linter/rules/unused-definition.d.ts +41 -0
- package/linter/rules/unused-definition.js +105 -0
- package/package.json +4 -1
- package/queries/base-query-format.d.ts +2 -0
- package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +2 -2
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
- package/queries/catalog/config-query/config-query-executor.d.ts +1 -1
- package/queries/catalog/config-query/config-query-executor.js +2 -3
- package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +3 -0
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +20 -0
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +81 -0
- package/queries/catalog/control-flow-query/control-flow-query-format.js +34 -0
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +4 -115
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
- package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-executor.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-executor.js +2 -2
- package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-format.js +17 -12
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
- package/queries/catalog/project-query/project-query-format.d.ts +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +4 -4
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +3 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -22
- package/queries/catalog/search-query/search-query-executor.d.ts +1 -1
- package/queries/catalog/search-query/search-query-executor.js +2 -2
- package/queries/catalog/search-query/search-query-format.d.ts +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +2 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
- package/queries/query.d.ts +75 -15
- package/queries/query.js +2 -0
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +2 -1
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +4 -2
- package/r-bridge/lang-4.x/convert-values.js +2 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +3 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +4 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +18 -9
- package/r-bridge/shell.d.ts +3 -2
- package/r-bridge/shell.js +4 -5
- package/search/flowr-search-builder.d.ts +6 -2
- package/search/flowr-search-builder.js +7 -0
- package/search/flowr-search-filters.d.ts +32 -8
- package/search/flowr-search-filters.js +42 -15
- package/search/flowr-search.d.ts +4 -0
- package/search/search-executor/search-enrichers.d.ts +7 -3
- package/search/search-executor/search-enrichers.js +32 -20
- package/search/search-executor/search-generators.js +1 -1
- package/search/search-executor/search-transformer.d.ts +2 -0
- package/search/search-executor/search-transformer.js +10 -1
- package/slicing/criterion/parse.d.ts +8 -0
- package/slicing/criterion/parse.js +20 -0
- package/slicing/static/static-slicer.d.ts +1 -1
- package/slicing/static/static-slicer.js +2 -3
- package/statistics/statistics.d.ts +3 -1
- package/statistics/statistics.js +5 -4
- package/util/containers.d.ts +12 -9
- package/util/containers.js +12 -9
- package/util/objects.d.ts +5 -4
- package/util/range.d.ts +5 -1
- package/util/range.js +11 -3
- package/util/text/strings.d.ts +6 -0
- package/util/text/strings.js +35 -0
- package/util/version.js +1 -1
- package/linter/rules/1-deprecated-functions.d.ts +0 -34
- package/linter/rules/1-deprecated-functions.js +0 -54
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bottomTopGuard = bottomTopGuard;
|
|
4
|
+
exports.valueSetGuard = valueSetGuard;
|
|
5
|
+
exports.valueFromTsValue = valueFromTsValue;
|
|
6
|
+
exports.valueFromRNodeConstant = valueFromRNodeConstant;
|
|
7
|
+
const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
|
|
8
|
+
const interval_constants_1 = require("./intervals/interval-constants");
|
|
9
|
+
const logical_constants_1 = require("./logical/logical-constants");
|
|
10
|
+
const r_value_1 = require("./r-value");
|
|
11
|
+
const string_constants_1 = require("./string/string-constants");
|
|
12
|
+
/**
|
|
13
|
+
* Takes n potentially lifted ops and returns `Top` or `Bottom` if any is `Top` or `Bottom`.
|
|
14
|
+
*/
|
|
15
|
+
function bottomTopGuard(...a) {
|
|
16
|
+
if (a.some(r_value_1.isBottom)) {
|
|
17
|
+
return r_value_1.Bottom;
|
|
18
|
+
}
|
|
19
|
+
else if (a.some(r_value_1.isTop)) {
|
|
20
|
+
return r_value_1.Top;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Returns a value set, if a is not bottom or top, otherwise undefined.
|
|
25
|
+
* Useful when working with values returned by {@link resolveIdToValue}
|
|
26
|
+
*
|
|
27
|
+
* @param a - value set to check
|
|
28
|
+
* @returns value set if a is not top or bottom
|
|
29
|
+
*/
|
|
30
|
+
function valueSetGuard(a) {
|
|
31
|
+
return ((0, r_value_1.isBottom)(a) || (0, r_value_1.isTop)(a)) ? undefined : a;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Constructs an Abstract Value from a normal TS value
|
|
35
|
+
* @param a - ts value
|
|
36
|
+
* @returns abstract value
|
|
37
|
+
*/
|
|
38
|
+
function valueFromTsValue(a) {
|
|
39
|
+
if (a === undefined) {
|
|
40
|
+
return r_value_1.Bottom;
|
|
41
|
+
}
|
|
42
|
+
else if (a === null) {
|
|
43
|
+
return r_value_1.Top;
|
|
44
|
+
}
|
|
45
|
+
else if (typeof a === 'string') {
|
|
46
|
+
return (0, string_constants_1.stringFrom)(a);
|
|
47
|
+
}
|
|
48
|
+
else if (typeof a === 'number') {
|
|
49
|
+
return (0, interval_constants_1.intervalFrom)(a, a);
|
|
50
|
+
}
|
|
51
|
+
else if (typeof a === 'boolean') {
|
|
52
|
+
return a ? logical_constants_1.ValueLogicalTrue : logical_constants_1.ValueLogicalFalse;
|
|
53
|
+
}
|
|
54
|
+
return r_value_1.Top;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Converts a constant from an RNode into an abstract value
|
|
58
|
+
* @param a - RNode constant
|
|
59
|
+
* @returns abstract value
|
|
60
|
+
*/
|
|
61
|
+
function valueFromRNodeConstant(a) {
|
|
62
|
+
if (a.type === type_1.RType.String) {
|
|
63
|
+
return (0, string_constants_1.stringFrom)(a.content.str);
|
|
64
|
+
}
|
|
65
|
+
else if (a.type === type_1.RType.Number) {
|
|
66
|
+
return (0, interval_constants_1.intervalFrom)(a.content.num, a.content.num);
|
|
67
|
+
}
|
|
68
|
+
else if (a.type === type_1.RType.Logical) {
|
|
69
|
+
return a.content.valueOf() ? logical_constants_1.ValueLogicalTrue : logical_constants_1.ValueLogicalFalse;
|
|
70
|
+
}
|
|
71
|
+
return r_value_1.Top;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=general.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RNumberValue } from '../../../../r-bridge/lang-4.x/convert-values';
|
|
2
|
+
import type { Lift, ValueInterval, ValueNumber } from '../r-value';
|
|
3
|
+
export declare function intervalFrom(start: RNumberValue | number, end?: number | RNumberValue, startInclusive?: boolean, endInclusive?: boolean): ValueInterval;
|
|
4
|
+
export declare function intervalFromValues(start: Lift<ValueNumber>, end?: Lift<ValueNumber<Lift<RNumberValue>>>, startInclusive?: boolean, endInclusive?: boolean): ValueInterval;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.intervalFrom = intervalFrom;
|
|
4
|
+
exports.intervalFromValues = intervalFromValues;
|
|
5
|
+
const r_value_1 = require("../r-value");
|
|
6
|
+
const scalar_consatnts_1 = require("../scalar/scalar-consatnts");
|
|
7
|
+
function intervalFrom(start, end = start, startInclusive = true, endInclusive = true) {
|
|
8
|
+
return intervalFromValues(typeof start === 'number' ? (0, scalar_consatnts_1.getScalarFromInteger)(start) : (0, scalar_consatnts_1.liftScalar)(start), typeof end === 'number' ? (0, scalar_consatnts_1.getScalarFromInteger)(end) : (0, scalar_consatnts_1.liftScalar)(end), startInclusive, endInclusive);
|
|
9
|
+
}
|
|
10
|
+
function shiftNum(v) {
|
|
11
|
+
if ((0, r_value_1.isBottom)(v) || (0, r_value_1.isTop)(v)) {
|
|
12
|
+
return (0, scalar_consatnts_1.liftScalar)(v);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return v;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function intervalFromValues(start, end = start, startInclusive = true, endInclusive = true) {
|
|
19
|
+
return {
|
|
20
|
+
type: 'interval',
|
|
21
|
+
start: shiftNum(start),
|
|
22
|
+
end: shiftNum(end),
|
|
23
|
+
startInclusive,
|
|
24
|
+
endInclusive,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=interval-constants.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Lift, TernaryLogical, ValueLogical } from '../r-value';
|
|
2
|
+
export declare function liftLogical(log: Lift<TernaryLogical>): ValueLogical;
|
|
3
|
+
export declare const ValueLogicalTrue: ValueLogical;
|
|
4
|
+
export declare const ValueLogicalFalse: ValueLogical;
|
|
5
|
+
export declare const ValueLogicalMaybe: ValueLogical;
|
|
6
|
+
export declare const ValueLogicalTop: ValueLogical;
|
|
7
|
+
export declare const ValueLogicalBot: ValueLogical;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValueLogicalBot = exports.ValueLogicalTop = exports.ValueLogicalMaybe = exports.ValueLogicalFalse = exports.ValueLogicalTrue = void 0;
|
|
4
|
+
exports.liftLogical = liftLogical;
|
|
5
|
+
const r_value_1 = require("../r-value");
|
|
6
|
+
function liftLogical(log) {
|
|
7
|
+
if (log === r_value_1.Top) {
|
|
8
|
+
return exports.ValueLogicalTop;
|
|
9
|
+
}
|
|
10
|
+
else if (log === r_value_1.Bottom) {
|
|
11
|
+
return exports.ValueLogicalBot;
|
|
12
|
+
}
|
|
13
|
+
else if (log === 'maybe') {
|
|
14
|
+
return exports.ValueLogicalMaybe;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return log ? exports.ValueLogicalTrue : exports.ValueLogicalFalse;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function makeLogical(log) {
|
|
21
|
+
return {
|
|
22
|
+
type: 'logical',
|
|
23
|
+
value: log
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
exports.ValueLogicalTrue = makeLogical(true);
|
|
27
|
+
exports.ValueLogicalFalse = makeLogical(false);
|
|
28
|
+
exports.ValueLogicalMaybe = makeLogical('maybe');
|
|
29
|
+
exports.ValueLogicalTop = makeLogical(r_value_1.Top);
|
|
30
|
+
exports.ValueLogicalBot = makeLogical(r_value_1.Bottom);
|
|
31
|
+
//# sourceMappingURL=logical-constants.js.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { RNumberValue, RStringValue } from '../../../r-bridge/lang-4.x/convert-values';
|
|
2
|
+
import type { RLogicalValue } from '../../../r-bridge/lang-4.x/ast/model/nodes/r-logical';
|
|
3
|
+
export declare const Top: {
|
|
4
|
+
type: symbol;
|
|
5
|
+
};
|
|
6
|
+
export declare const Bottom: {
|
|
7
|
+
type: symbol;
|
|
8
|
+
};
|
|
9
|
+
export type Lift<N> = N | typeof Top | typeof Bottom;
|
|
10
|
+
export type Unlift<N> = N extends typeof Top ? never : N extends typeof Bottom ? never : N;
|
|
11
|
+
export interface ValueInterval<Limit extends ValueNumber = ValueNumber> {
|
|
12
|
+
type: 'interval';
|
|
13
|
+
start: Limit;
|
|
14
|
+
startInclusive: boolean;
|
|
15
|
+
end: Limit;
|
|
16
|
+
endInclusive: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* An R vector with either a known set of elements or a known domain.
|
|
20
|
+
*/
|
|
21
|
+
export interface ValueVector<Elements extends Lift<unknown[]> = Lift<Value[]>, Domain extends Lift<Value> = Lift<Value>> {
|
|
22
|
+
type: 'vector';
|
|
23
|
+
elements: Elements;
|
|
24
|
+
/** if we do not know the amount of elements, we can still know the domain */
|
|
25
|
+
elementDomain: Domain;
|
|
26
|
+
}
|
|
27
|
+
/** describes the static case of we do not know which value */
|
|
28
|
+
export interface ValueSet<Elements extends Lift<unknown[]> = Lift<Value[]>> {
|
|
29
|
+
type: 'set';
|
|
30
|
+
elements: Elements;
|
|
31
|
+
}
|
|
32
|
+
export interface ValueNumber<Num extends Lift<RNumberValue> = Lift<RNumberValue>> {
|
|
33
|
+
type: 'number';
|
|
34
|
+
value: Num;
|
|
35
|
+
}
|
|
36
|
+
export interface ValueString<Str extends Lift<RStringValue> = Lift<RStringValue>> {
|
|
37
|
+
type: 'string';
|
|
38
|
+
value: Str;
|
|
39
|
+
}
|
|
40
|
+
export interface ValueMissing {
|
|
41
|
+
type: 'missing';
|
|
42
|
+
}
|
|
43
|
+
export type TernaryLogical = RLogicalValue | 'maybe';
|
|
44
|
+
export interface ValueLogical {
|
|
45
|
+
type: 'logical';
|
|
46
|
+
value: Lift<TernaryLogical>;
|
|
47
|
+
}
|
|
48
|
+
export type Value = Lift<ValueInterval | ValueVector | ValueSet | ValueNumber | ValueString | ValueLogical | ValueMissing>;
|
|
49
|
+
export type ValueType<V> = V extends {
|
|
50
|
+
type: infer T;
|
|
51
|
+
} ? T : never;
|
|
52
|
+
export type ValueTypes = ValueType<Value>;
|
|
53
|
+
export declare function typeOfValue<V extends Value>(value: V): V['type'];
|
|
54
|
+
export declare function isTop<V extends Lift<unknown>>(value: V): value is typeof Top;
|
|
55
|
+
export declare function isBottom<V extends Lift<unknown>>(value: V): value is typeof Bottom;
|
|
56
|
+
export declare function isValue<V extends Lift<unknown>>(value: V): value is Unlift<V>;
|
|
57
|
+
export declare function asValue<V extends Lift<unknown>>(value: V): Unlift<V>;
|
|
58
|
+
export declare function stringifyValue(value: Lift<Value>): string;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Bottom = exports.Top = void 0;
|
|
4
|
+
exports.typeOfValue = typeOfValue;
|
|
5
|
+
exports.isTop = isTop;
|
|
6
|
+
exports.isBottom = isBottom;
|
|
7
|
+
exports.isValue = isValue;
|
|
8
|
+
exports.asValue = asValue;
|
|
9
|
+
exports.stringifyValue = stringifyValue;
|
|
10
|
+
const assert_1 = require("../../../util/assert");
|
|
11
|
+
exports.Top = { type: Symbol('⊤') };
|
|
12
|
+
exports.Bottom = { type: Symbol('⊥') };
|
|
13
|
+
function typeOfValue(value) {
|
|
14
|
+
return value.type;
|
|
15
|
+
}
|
|
16
|
+
// @ts-expect-error -- this is a save cast
|
|
17
|
+
function isTop(value) {
|
|
18
|
+
return value === exports.Top;
|
|
19
|
+
}
|
|
20
|
+
// @ts-expect-error -- this is a save cast
|
|
21
|
+
function isBottom(value) {
|
|
22
|
+
return value === exports.Bottom;
|
|
23
|
+
}
|
|
24
|
+
function isValue(value) {
|
|
25
|
+
return !isTop(value) && !isBottom(value);
|
|
26
|
+
}
|
|
27
|
+
function asValue(value) {
|
|
28
|
+
(0, assert_1.guard)(isValue(value), 'Expected a value, but got a top or bottom value');
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
function tryStringifyBoTop(value, otherwise, onTop = () => '⊤', onBottom = () => '⊥') {
|
|
32
|
+
if (isTop(value)) {
|
|
33
|
+
return onTop();
|
|
34
|
+
}
|
|
35
|
+
else if (isBottom(value)) {
|
|
36
|
+
return onBottom();
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return otherwise(value);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function stringifyRNumberSuffix(value) {
|
|
43
|
+
let suffix = '';
|
|
44
|
+
if (value.markedAsInt) {
|
|
45
|
+
suffix += 'L';
|
|
46
|
+
}
|
|
47
|
+
if (value.complexNumber) {
|
|
48
|
+
suffix += 'i';
|
|
49
|
+
}
|
|
50
|
+
// do something about iL even though it is impossible?
|
|
51
|
+
return suffix;
|
|
52
|
+
}
|
|
53
|
+
function renderString(value) {
|
|
54
|
+
const quote = value.quotes;
|
|
55
|
+
const raw = value.flag === 'raw';
|
|
56
|
+
if (raw) {
|
|
57
|
+
return `r${quote}(${value.str})${quote}`;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
return `${quote}${JSON.stringify(value.str).slice(1, -1)}${quote}`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function stringifyValue(value) {
|
|
64
|
+
return tryStringifyBoTop(value, v => {
|
|
65
|
+
const t = v.type;
|
|
66
|
+
switch (t) {
|
|
67
|
+
case 'interval':
|
|
68
|
+
return `${v.startInclusive ? '[' : '('}${stringifyValue(v.start)}, ${stringifyValue(v.end)}${v.endInclusive ? ']' : ')'}`;
|
|
69
|
+
case 'vector':
|
|
70
|
+
return tryStringifyBoTop(v.elements, e => {
|
|
71
|
+
return `<${stringifyValue(v.elementDomain)}> c(${e.map(stringifyValue).join(',')})`;
|
|
72
|
+
}, () => `⊤ (vector, ${stringifyValue(v.elementDomain)})`, () => `⊥ (vector, ${stringifyValue(v.elementDomain)})`);
|
|
73
|
+
case 'set':
|
|
74
|
+
return tryStringifyBoTop(v.elements, e => {
|
|
75
|
+
return e.length === 1 ? stringifyValue(e[0]) : `{ ${e.map(stringifyValue).join(',')} }`;
|
|
76
|
+
}, () => '⊤ (set)', () => '⊥ (set)');
|
|
77
|
+
case 'number':
|
|
78
|
+
return tryStringifyBoTop(v.value, n => `${n.num}${stringifyRNumberSuffix(n)}`, () => '⊤ (number)', () => '⊥ (number)');
|
|
79
|
+
case 'string':
|
|
80
|
+
return tryStringifyBoTop(v.value, renderString, () => '⊤ (string)', () => '⊥ (string)');
|
|
81
|
+
case 'logical':
|
|
82
|
+
return tryStringifyBoTop(v.value, l => l === 'maybe' ? 'maybe' : l ? 'TRUE' : 'FALSE', () => '⊤ (logical)', () => '⊥ (logical)');
|
|
83
|
+
case 'missing':
|
|
84
|
+
return '(missing)';
|
|
85
|
+
default:
|
|
86
|
+
(0, assert_1.assertUnreachable)(t);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=r-value.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Lift, ValueNumber } from '../r-value';
|
|
2
|
+
import type { RNumberValue } from '../../../../r-bridge/lang-4.x/convert-values';
|
|
3
|
+
export declare function getScalarFromInteger(num: number, markedAsInt?: boolean, complexNumber?: boolean): ValueNumber<RNumberValue>;
|
|
4
|
+
export declare function liftScalar(value: Lift<RNumberValue>): ValueNumber;
|
|
5
|
+
export declare const ValueIntegerOne: ValueNumber<RNumberValue>;
|
|
6
|
+
export declare const ValueNumberComplexOne: ValueNumber<RNumberValue>;
|
|
7
|
+
export declare const ValueIntegerZero: ValueNumber<RNumberValue>;
|
|
8
|
+
export declare const ValueIntegerNegativeOne: ValueNumber<RNumberValue>;
|
|
9
|
+
export declare const ValueIntegerPositiveInfinity: ValueNumber<RNumberValue>;
|
|
10
|
+
export declare const ValueNumberPositiveInfinity: ValueNumber<RNumberValue>;
|
|
11
|
+
export declare const ValueIntegerNegativeInfinity: ValueNumber<RNumberValue>;
|
|
12
|
+
export declare const ValueNumberEpsilon: ValueNumber<RNumberValue>;
|
|
13
|
+
export declare const ValueNumberOneHalf: ValueNumber<RNumberValue>;
|
|
14
|
+
export declare const ValueIntegerTop: ValueNumber<Lift<RNumberValue>>;
|
|
15
|
+
export declare const ValueIntegerBottom: ValueNumber<Lift<RNumberValue>>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValueIntegerBottom = exports.ValueIntegerTop = exports.ValueNumberOneHalf = exports.ValueNumberEpsilon = exports.ValueIntegerNegativeInfinity = exports.ValueNumberPositiveInfinity = exports.ValueIntegerPositiveInfinity = exports.ValueIntegerNegativeOne = exports.ValueIntegerZero = exports.ValueNumberComplexOne = exports.ValueIntegerOne = void 0;
|
|
4
|
+
exports.getScalarFromInteger = getScalarFromInteger;
|
|
5
|
+
exports.liftScalar = liftScalar;
|
|
6
|
+
const r_value_1 = require("../r-value");
|
|
7
|
+
function getScalarFromInteger(num, markedAsInt = Number.isInteger(num), complexNumber = false) {
|
|
8
|
+
return {
|
|
9
|
+
type: 'number',
|
|
10
|
+
value: {
|
|
11
|
+
markedAsInt,
|
|
12
|
+
num,
|
|
13
|
+
complexNumber
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function liftScalar(value) {
|
|
18
|
+
return {
|
|
19
|
+
type: 'number',
|
|
20
|
+
value: value
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const epsilon = 1e-7;
|
|
24
|
+
exports.ValueIntegerOne = getScalarFromInteger(1);
|
|
25
|
+
exports.ValueNumberComplexOne = getScalarFromInteger(1, false, true);
|
|
26
|
+
exports.ValueIntegerZero = getScalarFromInteger(0);
|
|
27
|
+
exports.ValueIntegerNegativeOne = getScalarFromInteger(-1);
|
|
28
|
+
exports.ValueIntegerPositiveInfinity = getScalarFromInteger(Number.POSITIVE_INFINITY);
|
|
29
|
+
exports.ValueNumberPositiveInfinity = getScalarFromInteger(Number.POSITIVE_INFINITY, false);
|
|
30
|
+
exports.ValueIntegerNegativeInfinity = getScalarFromInteger(Number.NEGATIVE_INFINITY);
|
|
31
|
+
exports.ValueNumberEpsilon = getScalarFromInteger(epsilon, false);
|
|
32
|
+
exports.ValueNumberOneHalf = getScalarFromInteger(0.5, false);
|
|
33
|
+
exports.ValueIntegerTop = liftScalar(r_value_1.Top);
|
|
34
|
+
exports.ValueIntegerBottom = liftScalar(r_value_1.Bottom);
|
|
35
|
+
//# sourceMappingURL=scalar-consatnts.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Lift, Value, ValueSet } from '../r-value';
|
|
2
|
+
import { Top } from '../r-value';
|
|
3
|
+
export declare function setFrom<V extends Value[]>(...elements: V): Lift<ValueSet<Value[]>>;
|
|
4
|
+
export declare function isSet<V extends Value>(element: V): boolean;
|
|
5
|
+
export declare const ValueEmptySet: Lift<ValueSet<Value[]>>;
|
|
6
|
+
export declare const ValueSetTop: ValueSet<typeof Top>;
|
|
7
|
+
export declare const ValueSetBottom: ValueSet<typeof Top>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValueSetBottom = exports.ValueSetTop = exports.ValueEmptySet = void 0;
|
|
4
|
+
exports.setFrom = setFrom;
|
|
5
|
+
exports.isSet = isSet;
|
|
6
|
+
const general_1 = require("../general");
|
|
7
|
+
const r_value_1 = require("../r-value");
|
|
8
|
+
function flattenSetElements(s) {
|
|
9
|
+
return (0, general_1.bottomTopGuard)(s) ?? s.flatMap(e => {
|
|
10
|
+
return e.type === 'set' ? flattenSetElements(e.elements) : e;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function setFrom(...elements) {
|
|
14
|
+
const vals = elements.flatMap(e => {
|
|
15
|
+
return e.type === 'set' ? flattenSetElements(e.elements) : e;
|
|
16
|
+
});
|
|
17
|
+
return (0, general_1.bottomTopGuard)(...vals) ?? {
|
|
18
|
+
type: 'set',
|
|
19
|
+
elements: vals
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function isSet(element) {
|
|
23
|
+
return element.type === 'set';
|
|
24
|
+
}
|
|
25
|
+
exports.ValueEmptySet = setFrom();
|
|
26
|
+
exports.ValueSetTop = {
|
|
27
|
+
type: 'set',
|
|
28
|
+
elements: r_value_1.Top
|
|
29
|
+
};
|
|
30
|
+
exports.ValueSetBottom = {
|
|
31
|
+
type: 'set',
|
|
32
|
+
elements: r_value_1.Top
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=set-constants.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RStringValue } from '../../../../r-bridge/lang-4.x/convert-values';
|
|
2
|
+
import type { Lift, Value, ValueString } from '../r-value';
|
|
3
|
+
export declare function stringFrom(str: RStringValue | string): ValueString;
|
|
4
|
+
export declare function liftString(str: Lift<RStringValue>): ValueString;
|
|
5
|
+
export declare function collectStrings(a: Value[], withQuotes?: boolean): string[] | undefined;
|
|
6
|
+
export declare const ValueEmptyString: ValueString<Lift<RStringValue>>;
|
|
7
|
+
export declare const ValueStringTop: ValueString<Lift<RStringValue>>;
|
|
8
|
+
export declare const ValueStringBot: ValueString<Lift<RStringValue>>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValueStringBot = exports.ValueStringTop = exports.ValueEmptyString = void 0;
|
|
4
|
+
exports.stringFrom = stringFrom;
|
|
5
|
+
exports.liftString = liftString;
|
|
6
|
+
exports.collectStrings = collectStrings;
|
|
7
|
+
const general_1 = require("../general");
|
|
8
|
+
const r_value_1 = require("../r-value");
|
|
9
|
+
function stringFrom(str) {
|
|
10
|
+
return {
|
|
11
|
+
type: 'string',
|
|
12
|
+
value: typeof str === 'string' ? {
|
|
13
|
+
quotes: '"',
|
|
14
|
+
str: str
|
|
15
|
+
} : str,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function liftString(str) {
|
|
19
|
+
return {
|
|
20
|
+
type: 'string',
|
|
21
|
+
value: str
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function collectStrings(a, withQuotes = false) {
|
|
25
|
+
if ((0, general_1.bottomTopGuard)(a)) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
const values = [];
|
|
29
|
+
for (const value of a) {
|
|
30
|
+
if (value.type !== 'string' || !(0, r_value_1.isValue)(value) || !(0, r_value_1.isValue)(value.value)) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
if (withQuotes) {
|
|
34
|
+
values.push(`${value.value.quotes}${value.value.str}${value.value.quotes}`);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
values.push(value.value.str);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return values;
|
|
41
|
+
}
|
|
42
|
+
exports.ValueEmptyString = stringFrom('');
|
|
43
|
+
exports.ValueStringTop = liftString(r_value_1.Top);
|
|
44
|
+
exports.ValueStringBot = liftString(r_value_1.Bottom);
|
|
45
|
+
//# sourceMappingURL=string-constants.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Lift, Value, ValueVector } from '../r-value';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an abstract vector from abstract values
|
|
4
|
+
* @param elements - elements that the vector should contain
|
|
5
|
+
* @returns abstract ValueVector
|
|
6
|
+
*/
|
|
7
|
+
export declare function vectorFrom<V extends Lift<Value[]>>(elements: V): ValueVector<V>;
|
|
8
|
+
/**
|
|
9
|
+
* Flattens all elements inside of a vector
|
|
10
|
+
* A set containing only one element is also replaced by its only element
|
|
11
|
+
* @param s - vector to flatten
|
|
12
|
+
* @returns flattened vactor, if all elements are not bottom / top
|
|
13
|
+
*/
|
|
14
|
+
export declare function flattenVectorElements(s: Lift<Value[]>): Lift<Value[]>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.vectorFrom = vectorFrom;
|
|
4
|
+
exports.flattenVectorElements = flattenVectorElements;
|
|
5
|
+
const r_value_1 = require("../r-value");
|
|
6
|
+
const assert_1 = require("../../../../util/assert");
|
|
7
|
+
const general_1 = require("../general");
|
|
8
|
+
/**
|
|
9
|
+
* Creates an abstract vector from abstract values
|
|
10
|
+
* @param elements - elements that the vector should contain
|
|
11
|
+
* @returns abstract ValueVector
|
|
12
|
+
*/
|
|
13
|
+
function vectorFrom(elements) {
|
|
14
|
+
(0, assert_1.guard)((0, r_value_1.isTop)(elements) || (0, r_value_1.isBottom)(elements) || Array.isArray(elements), 'Expected array of values');
|
|
15
|
+
return {
|
|
16
|
+
type: 'vector',
|
|
17
|
+
elements,
|
|
18
|
+
elementDomain: r_value_1.Top
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Flattens all elements inside of a vector
|
|
23
|
+
* A set containing only one element is also replaced by its only element
|
|
24
|
+
* @param s - vector to flatten
|
|
25
|
+
* @returns flattened vactor, if all elements are not bottom / top
|
|
26
|
+
*/
|
|
27
|
+
function flattenVectorElements(s) {
|
|
28
|
+
return (0, general_1.bottomTopGuard)(s) ?? s.flatMap(e => {
|
|
29
|
+
return e.type === 'vector' ? flattenVectorElements(e.elements) :
|
|
30
|
+
e.type === 'set' && (0, r_value_1.isValue)(e.elements) && e.elements.length === 1 ?
|
|
31
|
+
e.elements[0].type === 'vector' ? flattenVectorElements(e.elements[0].elements) : e.elements :
|
|
32
|
+
e;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=vector-constants.js.map
|
package/dataflow/extractor.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { DataflowProcessors } from './processor';
|
|
|
3
3
|
import type { NormalizedAst, ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
4
|
import type { RParseRequests } from '../r-bridge/retriever';
|
|
5
5
|
import type { KnownParserType, Parser } from '../r-bridge/parser';
|
|
6
|
+
import type { FlowrConfigOptions } from '../config';
|
|
6
7
|
/**
|
|
7
8
|
* The best friend of {@link produceDataFlowGraph} and {@link processDataflowFor}.
|
|
8
9
|
* Maps every {@link RType} in the normalized AST to a processor.
|
|
@@ -14,4 +15,4 @@ export declare const processors: DataflowProcessors<ParentInformation>;
|
|
|
14
15
|
* (e.g., in the event of a `source` call).
|
|
15
16
|
* For the actual, canonical fold entry point, see {@link processDataflowFor}.
|
|
16
17
|
*/
|
|
17
|
-
export declare function produceDataFlowGraph<OtherInfo>(parser: Parser<KnownParserType>, request: RParseRequests, completeAst: NormalizedAst<OtherInfo & ParentInformation
|
|
18
|
+
export declare function produceDataFlowGraph<OtherInfo>(parser: Parser<KnownParserType>, request: RParseRequests, completeAst: NormalizedAst<OtherInfo & ParentInformation>, config: FlowrConfigOptions): DataflowInformation;
|
package/dataflow/extractor.js
CHANGED
|
@@ -80,7 +80,7 @@ function resolveLinkToSideEffects(ast, graph) {
|
|
|
80
80
|
* (e.g., in the event of a `source` call).
|
|
81
81
|
* For the actual, canonical fold entry point, see {@link processDataflowFor}.
|
|
82
82
|
*/
|
|
83
|
-
function produceDataFlowGraph(parser, request, completeAst) {
|
|
83
|
+
function produceDataFlowGraph(parser, request, completeAst, config) {
|
|
84
84
|
let firstRequest;
|
|
85
85
|
const multifile = Array.isArray(request);
|
|
86
86
|
if (multifile) {
|
|
@@ -97,6 +97,7 @@ function produceDataFlowGraph(parser, request, completeAst) {
|
|
|
97
97
|
currentRequest: firstRequest,
|
|
98
98
|
controlDependencies: undefined,
|
|
99
99
|
referenceChain: [firstRequest],
|
|
100
|
+
flowrConfig: config
|
|
100
101
|
};
|
|
101
102
|
let df = (0, processor_1.processDataflowFor)(completeAst.ast, dfData);
|
|
102
103
|
df.graph.sourced.unshift(firstRequest.request === 'file' ? firstRequest.content : '<inline>');
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
2
|
+
import type { REnvironmentInformation } from '../environments/environment';
|
|
3
|
+
export type ReplacementOperatorHandlerArgs = {
|
|
4
|
+
operator: string;
|
|
5
|
+
target: string | undefined;
|
|
6
|
+
env: REnvironmentInformation;
|
|
7
|
+
id: NodeId;
|
|
8
|
+
};
|
|
9
|
+
export type ReplacementOperatorHandler = (args: ReplacementOperatorHandlerArgs) => void;
|
|
10
|
+
export declare function onReplacementOperator(handler: ReplacementOperatorHandler): void;
|
|
11
|
+
export declare function handleReplacementOperator(args: ReplacementOperatorHandlerArgs): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.onReplacementOperator = onReplacementOperator;
|
|
4
|
+
exports.handleReplacementOperator = handleReplacementOperator;
|
|
5
|
+
const handlers = [];
|
|
6
|
+
function onReplacementOperator(handler) {
|
|
7
|
+
handlers.push(handler);
|
|
8
|
+
}
|
|
9
|
+
function handleReplacementOperator(args) {
|
|
10
|
+
handlers.forEach(handler => handler(args));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=unknown-replacement.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LinkTo } from '../../queries/catalog/call-context-query/call-context-query-format';
|
|
2
|
+
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
3
|
+
import type { REnvironmentInformation } from '../environments/environment';
|
|
4
|
+
import type { DataflowGraph } from './graph';
|
|
5
|
+
export type UnknownSideEffectHandler = (graph: DataflowGraph, env: REnvironmentInformation, id: NodeId, target?: LinkTo<RegExp | string>) => void;
|
|
6
|
+
export declare function onUnknownSideEffect(handler: UnknownSideEffectHandler): void;
|
|
7
|
+
export declare function handleUnknownSideEffect(graph: DataflowGraph, env: REnvironmentInformation, id: NodeId, target?: LinkTo<RegExp | string>): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.onUnknownSideEffect = onUnknownSideEffect;
|
|
4
|
+
exports.handleUnknownSideEffect = handleUnknownSideEffect;
|
|
5
|
+
const handlers = [];
|
|
6
|
+
function onUnknownSideEffect(handler) {
|
|
7
|
+
handlers.push(handler);
|
|
8
|
+
}
|
|
9
|
+
function handleUnknownSideEffect(graph, env, id, target) {
|
|
10
|
+
graph.markIdForUnknownSideEffects(id, target);
|
|
11
|
+
handlers.forEach(handler => handler(graph, env, id, target));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=unknown-side-effect.js.map
|
|
@@ -13,7 +13,6 @@ const built_in_assignment_1 = require("./built-in-assignment");
|
|
|
13
13
|
const identifier_1 = require("../../../../../environments/identifier");
|
|
14
14
|
const vertex_1 = require("../../../../../graph/vertex");
|
|
15
15
|
const containers_1 = require("../../../../../../util/containers");
|
|
16
|
-
const config_1 = require("../../../../../../config");
|
|
17
16
|
function tableAssignmentProcessor(name, args, rootId, data, outInfo) {
|
|
18
17
|
outInfo.definitionRootNodes.push(rootId);
|
|
19
18
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, origin: 'table:assign' }).information;
|
|
@@ -30,8 +29,8 @@ function tableAssignmentProcessor(name, args, rootId, data, outInfo) {
|
|
|
30
29
|
* ```
|
|
31
30
|
*/
|
|
32
31
|
function processAccess(name, args, rootId, data, config) {
|
|
33
|
-
if (args.length <
|
|
34
|
-
logger_1.dataflowLogger.warn(`Access ${name.content} has less than
|
|
32
|
+
if (args.length < 1) {
|
|
33
|
+
logger_1.dataflowLogger.warn(`Access ${name.content} has less than 1 argument, skipping`);
|
|
35
34
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin: 'default' }).information;
|
|
36
35
|
}
|
|
37
36
|
const head = args[0];
|
|
@@ -113,9 +112,9 @@ function processNumberBasedAccess(data, name, args, rootId, config, head) {
|
|
|
113
112
|
data.environment.current.memory.set(':=', existing);
|
|
114
113
|
}
|
|
115
114
|
if (head.value && outInfo.definitionRootNodes.length > 0) {
|
|
116
|
-
(0, built_in_assignment_1.markAsAssignment)(fnCall.information, { type: identifier_1.ReferenceType.Variable, name: head.value.lexeme ?? '', nodeId: head.value.info.id, definedAt: rootId, controlDependencies: [] }, outInfo.definitionRootNodes, rootId);
|
|
115
|
+
(0, built_in_assignment_1.markAsAssignment)(fnCall.information, { type: identifier_1.ReferenceType.Variable, name: head.value.lexeme ?? '', nodeId: head.value.info.id, definedAt: rootId, controlDependencies: [] }, outInfo.definitionRootNodes, rootId, data.flowrConfig);
|
|
117
116
|
}
|
|
118
|
-
if (
|
|
117
|
+
if (data.flowrConfig.solver.pointerTracking) {
|
|
119
118
|
referenceAccessedIndices(args, data, fnCall, rootId, true);
|
|
120
119
|
}
|
|
121
120
|
return fnCall;
|
|
@@ -157,7 +156,7 @@ function processStringBasedAccess(args, data, name, rootId, config) {
|
|
|
157
156
|
const fnCall = (0, known_call_handling_1.processKnownFunctionCall)({ name, args: newArgs, rootId, data, forceArgs: config.forceArgs,
|
|
158
157
|
origin: 'builtin:access'
|
|
159
158
|
});
|
|
160
|
-
if (
|
|
159
|
+
if (data.flowrConfig.solver.pointerTracking) {
|
|
161
160
|
referenceAccessedIndices(newArgs, data, fnCall, rootId, false);
|
|
162
161
|
}
|
|
163
162
|
return fnCall;
|