@eagleoutice/flowr 2.2.15 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +226 -6
- package/abstract-interpretation/data-frame/absint-info.d.ts +109 -0
- package/abstract-interpretation/data-frame/absint-info.js +31 -0
- package/abstract-interpretation/data-frame/absint-visitor.d.ts +59 -0
- package/abstract-interpretation/data-frame/absint-visitor.js +173 -0
- package/abstract-interpretation/data-frame/domain.d.ts +107 -0
- package/abstract-interpretation/data-frame/domain.js +315 -0
- package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +17 -0
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +166 -0
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +117 -0
- package/abstract-interpretation/data-frame/mappers/arguments.js +188 -0
- package/abstract-interpretation/data-frame/mappers/assignment-mapper.d.ts +20 -0
- package/abstract-interpretation/data-frame/mappers/assignment-mapper.js +34 -0
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +261 -0
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +1219 -0
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +12 -0
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +206 -0
- package/abstract-interpretation/data-frame/resolve-args.d.ts +42 -0
- package/abstract-interpretation/data-frame/resolve-args.js +118 -0
- package/abstract-interpretation/data-frame/semantics.d.ts +213 -0
- package/abstract-interpretation/data-frame/semantics.js +366 -0
- package/abstract-interpretation/data-frame/shape-inference.d.ts +38 -0
- package/abstract-interpretation/data-frame/shape-inference.js +117 -0
- package/benchmark/slicer.d.ts +18 -2
- package/benchmark/slicer.js +143 -5
- package/benchmark/stats/print.js +123 -45
- package/benchmark/stats/size-of.d.ts +7 -0
- package/benchmark/stats/size-of.js +1 -0
- package/benchmark/stats/stats.d.ts +30 -1
- package/benchmark/stats/stats.js +4 -2
- package/benchmark/summarizer/data.d.ts +33 -2
- package/benchmark/summarizer/first-phase/input.js +5 -1
- package/benchmark/summarizer/first-phase/process.d.ts +2 -1
- package/benchmark/summarizer/first-phase/process.js +49 -3
- package/benchmark/summarizer/second-phase/process.js +101 -3
- package/cli/benchmark-app.d.ts +2 -0
- package/cli/benchmark-app.js +5 -1
- package/cli/benchmark-helper-app.d.ts +2 -0
- package/cli/benchmark-helper-app.js +13 -8
- package/cli/common/options.js +4 -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 +2 -2
- 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 +4 -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 +43 -10
- package/config.js +47 -43
- package/control-flow/cfg-dead-code.js +45 -2
- package/control-flow/cfg-simplification.d.ts +2 -0
- package/control-flow/control-flow-graph.d.ts +2 -0
- package/control-flow/control-flow-graph.js +8 -0
- package/control-flow/dfg-cfg-guided-visitor.d.ts +5 -3
- package/control-flow/dfg-cfg-guided-visitor.js +15 -4
- package/control-flow/extract-cfg.d.ts +4 -2
- package/control-flow/extract-cfg.js +4 -3
- package/control-flow/semantic-cfg-guided-visitor.d.ts +20 -2
- package/control-flow/semantic-cfg-guided-visitor.js +24 -4
- 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 +3 -3
- package/dataflow/environments/built-in.d.ts +11 -3
- package/dataflow/environments/built-in.js +5 -3
- package/dataflow/environments/default-builtin-config.js +4 -2
- 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/eval/resolve/alias-tracking.d.ts +7 -2
- package/dataflow/eval/resolve/alias-tracking.js +11 -8
- 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 +65 -18
- package/dataflow/eval/resolve/resolve.js +144 -48
- package/dataflow/eval/values/string/string-constants.d.ts +1 -1
- package/dataflow/eval/values/string/string-constants.js +7 -2
- package/dataflow/extractor.d.ts +2 -1
- package/dataflow/extractor.js +2 -1
- 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 +1 -1
- 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 +11 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +10 -11
- 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 +1 -1
- 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 +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +6 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +19 -15
- 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 +1 -1
- package/dataflow/internal/process/functions/call/common.js +1 -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.js +13 -2
- 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 +6 -7
- package/documentation/print-core-wiki.js +5 -5
- package/documentation/print-dataflow-graph-wiki.js +10 -10
- package/documentation/print-engines-wiki.js +1 -2
- package/documentation/print-faq-wiki.js +8 -2
- package/documentation/print-interface-wiki.js +12 -2
- package/documentation/print-linter-issue.d.ts +1 -0
- package/documentation/print-linter-issue.js +71 -0
- package/documentation/print-linter-wiki.js +223 -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 +18 -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 +178 -16
- package/linter/linter-rules.js +14 -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/dataframe-access-validation.d.ts +53 -0
- package/linter/rules/dataframe-access-validation.js +116 -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 +168 -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 +5 -2
- 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 +1 -1
- package/queries/catalog/control-flow-query/control-flow-query-executor.js +2 -2
- package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
- 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 -116
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
- package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +3 -0
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +46 -0
- package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +72 -0
- package/queries/catalog/df-shape-query/df-shape-query-format.js +31 -0
- 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 +16 -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 +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
- 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 +76 -16
- 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 +7 -5
- 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 +29 -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/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/files.d.ts +8 -2
- package/util/files.js +22 -4
- package/util/objects.d.ts +5 -4
- package/util/r-value.d.ts +23 -0
- package/util/r-value.js +113 -0
- 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
- package/util/cfg/cfg.d.ts +0 -0
- package/util/cfg/cfg.js +0 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Value, ValueInterval, ValueLogical, ValueNumber, ValueString, ValueVector } from '../dataflow/eval/values/r-value';
|
|
2
|
+
import type { RLogicalValue } from '../r-bridge/lang-4.x/ast/model/nodes/r-logical';
|
|
3
|
+
import { type RNumberValue, type RStringValue } from '../r-bridge/lang-4.x/convert-values';
|
|
4
|
+
export declare function isRStringValue(value: unknown): value is RStringValue;
|
|
5
|
+
export declare function isRNumberValue(value: unknown): value is RNumberValue;
|
|
6
|
+
export declare function isRLogicalValue(value: unknown): value is RLogicalValue;
|
|
7
|
+
export declare function unwrapRValue(value: RStringValue | string): string;
|
|
8
|
+
export declare function unwrapRValue(value: RNumberValue | number): number;
|
|
9
|
+
export declare function unwrapRValue(value: RLogicalValue): boolean;
|
|
10
|
+
export declare function unwrapRValue(value: RStringValue | RNumberValue | RLogicalValue | string | number): string | number | boolean;
|
|
11
|
+
export declare function unwrapRValue(value: unknown): string | number | boolean | undefined;
|
|
12
|
+
export declare function unwrapRVector(value: RStringValue[] | string[]): string[];
|
|
13
|
+
export declare function unwrapRVector(value: RNumberValue[] | number[]): number[];
|
|
14
|
+
export declare function unwrapRVector(value: RLogicalValue[]): boolean[];
|
|
15
|
+
export declare function unwrapRVector(value: RStringValue[] | RNumberValue[] | RLogicalValue[] | string[] | number[]): string[] | number[] | boolean[];
|
|
16
|
+
export declare function unwrapRVector(value: unknown): string[] | number[] | boolean[] | (string | number | boolean)[] | undefined;
|
|
17
|
+
export declare function unwrapRValueToString(value: RStringValue | RNumberValue | RLogicalValue | string | number): string;
|
|
18
|
+
export declare function unwrapRValueToString(value: unknown): string | undefined;
|
|
19
|
+
export declare function unliftRValue(value: ValueString): RStringValue | undefined;
|
|
20
|
+
export declare function unliftRValue(value: ValueNumber | ValueInterval): RNumberValue | undefined;
|
|
21
|
+
export declare function unliftRValue(value: ValueLogical): RLogicalValue | undefined;
|
|
22
|
+
export declare function unliftRValue(value: ValueVector): (RStringValue | RNumberValue | RLogicalValue)[] | undefined;
|
|
23
|
+
export declare function unliftRValue(value: Value): RStringValue | RNumberValue | boolean | (RStringValue | RNumberValue | RLogicalValue)[] | undefined;
|
package/util/r-value.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRStringValue = isRStringValue;
|
|
4
|
+
exports.isRNumberValue = isRNumberValue;
|
|
5
|
+
exports.isRLogicalValue = isRLogicalValue;
|
|
6
|
+
exports.unwrapRValue = unwrapRValue;
|
|
7
|
+
exports.unwrapRVector = unwrapRVector;
|
|
8
|
+
exports.unwrapRValueToString = unwrapRValueToString;
|
|
9
|
+
exports.unliftRValue = unliftRValue;
|
|
10
|
+
const r_value_1 = require("../dataflow/eval/values/r-value");
|
|
11
|
+
const convert_values_1 = require("../r-bridge/lang-4.x/convert-values");
|
|
12
|
+
const assert_1 = require("./assert");
|
|
13
|
+
function isRValue(value) {
|
|
14
|
+
return isRStringValue(value) || isRNumberValue(value) || isRLogicalValue(value) || typeof value === 'string' || typeof value === 'number';
|
|
15
|
+
}
|
|
16
|
+
function isRStringValue(value) {
|
|
17
|
+
return typeof value === 'object' && value !== null && 'str' in value && typeof value.str === 'string';
|
|
18
|
+
}
|
|
19
|
+
function isRNumberValue(value) {
|
|
20
|
+
return typeof value === 'object' && value !== null && 'num' in value && typeof value.num === 'number';
|
|
21
|
+
}
|
|
22
|
+
function isRLogicalValue(value) {
|
|
23
|
+
return typeof value === 'boolean';
|
|
24
|
+
}
|
|
25
|
+
function unwrapRValue(value) {
|
|
26
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
else if (isRStringValue(value)) {
|
|
30
|
+
return value.str;
|
|
31
|
+
}
|
|
32
|
+
else if (isRNumberValue(value)) {
|
|
33
|
+
return value.num;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function unwrapRVector(value) {
|
|
40
|
+
if (!Array.isArray(value)) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
else if (value.every(entry => typeof entry === 'string') || value.every(entry => typeof entry === 'number') || value.every(entry => typeof entry === 'boolean')) {
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
else if (value.every(isRStringValue)) {
|
|
47
|
+
return value.map(entry => unwrapRValue(entry));
|
|
48
|
+
}
|
|
49
|
+
else if (value.every(isRNumberValue)) {
|
|
50
|
+
return value.map(entry => unwrapRValue(entry));
|
|
51
|
+
}
|
|
52
|
+
else if (value.every(isRValue)) {
|
|
53
|
+
return value.map(entry => unwrapRValue(entry));
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function unwrapRValueToString(value) {
|
|
60
|
+
if (typeof value === 'string') {
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
else if (typeof value === 'number') {
|
|
64
|
+
return value.toString();
|
|
65
|
+
}
|
|
66
|
+
else if (typeof value === 'boolean') {
|
|
67
|
+
return value ? convert_values_1.RTrue : convert_values_1.RFalse;
|
|
68
|
+
}
|
|
69
|
+
else if (isRStringValue(value)) {
|
|
70
|
+
return value.str;
|
|
71
|
+
}
|
|
72
|
+
else if (isRNumberValue(value)) {
|
|
73
|
+
return value.num.toString();
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function unliftRValue(value) {
|
|
80
|
+
if (!(0, r_value_1.isValue)(value)) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
const type = value.type;
|
|
84
|
+
switch (type) {
|
|
85
|
+
case 'string': {
|
|
86
|
+
return (0, r_value_1.isValue)(value.value) ? value.value : undefined;
|
|
87
|
+
}
|
|
88
|
+
case 'number': {
|
|
89
|
+
return (0, r_value_1.isValue)(value.value) ? value.value : undefined;
|
|
90
|
+
}
|
|
91
|
+
case 'logical': {
|
|
92
|
+
return (0, r_value_1.isValue)(value.value) && typeof value.value === 'boolean' ? value.value : undefined;
|
|
93
|
+
}
|
|
94
|
+
case 'interval': {
|
|
95
|
+
const start = unliftRValue(value.start);
|
|
96
|
+
const end = unliftRValue(value.end);
|
|
97
|
+
return start !== undefined && end !== undefined && start.num === end.num ? start : undefined;
|
|
98
|
+
}
|
|
99
|
+
case 'vector': {
|
|
100
|
+
const values = (0, r_value_1.isValue)(value.elements) ? value.elements.map(unliftRValue) : undefined;
|
|
101
|
+
return values?.every(assert_1.isNotUndefined) ? values.flat() : undefined;
|
|
102
|
+
}
|
|
103
|
+
case 'set': {
|
|
104
|
+
return (0, r_value_1.isValue)(value.elements) && value.elements.length === 1 ? unliftRValue(value.elements[0]) : undefined;
|
|
105
|
+
}
|
|
106
|
+
case 'missing': {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
default:
|
|
110
|
+
(0, assert_1.assertUnreachable)(type);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=r-value.js.map
|
package/util/range.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export declare function getRangeEnd(p: SourceRange | undefined): SourcePosition
|
|
|
45
45
|
* @param ec - end column
|
|
46
46
|
*/
|
|
47
47
|
export declare function rangeFrom(sl: number | string, sc: number | string, el: number | string, ec: number | string): SourceRange;
|
|
48
|
-
export declare function mergeRanges(...rs: SourceRange[]): SourceRange;
|
|
48
|
+
export declare function mergeRanges(...rs: (SourceRange | undefined)[]): SourceRange;
|
|
49
49
|
/**
|
|
50
50
|
* @returns true iff `r1` starts and ends before `r2` starts (i.e., if `r1` and `r2` do not overlap and `r1` comes before `r2`
|
|
51
51
|
*/
|
|
@@ -64,3 +64,7 @@ export declare function addRanges([r1sl, r1sc, r1el, r1ec]: SourceRange, [r2sl,
|
|
|
64
64
|
* @returns a positive number if `r1` comes after `r2`, a negative number if `r1` comes before `r2`, and `0` if they are equal
|
|
65
65
|
*/
|
|
66
66
|
export declare function rangeCompare([r1sl, r1sc, ,]: SourceRange, [r2sl, r2sc, ,]: SourceRange): number;
|
|
67
|
+
/**
|
|
68
|
+
* Checks if the first range is a subset of the second range.
|
|
69
|
+
*/
|
|
70
|
+
export declare function rangeIsSubsetOf([r1sl, r1sc, r1el, r1ec]: SourceRange, [r2sl, r2sc, r2el, r2ec]: SourceRange): boolean;
|
package/util/range.js
CHANGED
|
@@ -8,6 +8,7 @@ exports.rangeStartsCompletelyBefore = rangeStartsCompletelyBefore;
|
|
|
8
8
|
exports.rangesOverlap = rangesOverlap;
|
|
9
9
|
exports.addRanges = addRanges;
|
|
10
10
|
exports.rangeCompare = rangeCompare;
|
|
11
|
+
exports.rangeIsSubsetOf = rangeIsSubsetOf;
|
|
11
12
|
const assert_1 = require("./assert");
|
|
12
13
|
function getRangeStart(p) {
|
|
13
14
|
return p === undefined ? undefined : [p[0], p[1]];
|
|
@@ -27,11 +28,12 @@ function rangeFrom(sl, sc, el, ec) {
|
|
|
27
28
|
return [Number(sl), Number(sc), Number(el), Number(ec)];
|
|
28
29
|
}
|
|
29
30
|
function mergeRanges(...rs) {
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
const rsSafe = rs.filter(assert_1.isNotUndefined);
|
|
32
|
+
(0, assert_1.guard)(rsSafe.length > 0, 'Cannot merge no ranges');
|
|
33
|
+
return rsSafe.reduce(([sl, sc, el, ec], [nsl, nsc, nel, nec]) => [
|
|
32
34
|
...(sl < nsl || (sl === nsl && sc < nsc) ? [sl, sc] : [nsl, nsc]),
|
|
33
35
|
...(el > nel || (el === nel && ec > nec) ? [el, ec] : [nel, nec])
|
|
34
|
-
],
|
|
36
|
+
], rsSafe[0]);
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
37
39
|
* @returns true iff `r1` starts and ends before `r2` starts (i.e., if `r1` and `r2` do not overlap and `r1` comes before `r2`
|
|
@@ -64,4 +66,10 @@ function rangeCompare([r1sl, r1sc, ,], [r2sl, r2sc, ,]) {
|
|
|
64
66
|
return r1sl - r2sl;
|
|
65
67
|
}
|
|
66
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Checks if the first range is a subset of the second range.
|
|
71
|
+
*/
|
|
72
|
+
function rangeIsSubsetOf([r1sl, r1sc, r1el, r1ec], [r2sl, r2sc, r2el, r2ec]) {
|
|
73
|
+
return r1sl >= r2sl && r1sc >= r2sc && r1el <= r2el && r1ec <= r2ec;
|
|
74
|
+
}
|
|
67
75
|
//# sourceMappingURL=range.js.map
|
package/util/text/strings.d.ts
CHANGED
|
@@ -19,3 +19,9 @@ export declare function joinWithLast(strs: readonly string[], { join, last, join
|
|
|
19
19
|
last?: string;
|
|
20
20
|
joinTwo?: string;
|
|
21
21
|
}): string;
|
|
22
|
+
/**
|
|
23
|
+
* Check if the given path is an absolute path.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isAbsolutePath(p: string, regex: RegExp | undefined): boolean;
|
|
26
|
+
/** collect '-' at the start until '[' or '(' is reached, then drop the same from the end if present otherwise return the value as is */
|
|
27
|
+
export declare function dropRawStringSurround(value: string): string;
|
package/util/text/strings.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.startAndEndsWith = startAndEndsWith;
|
|
4
7
|
exports.withoutWhitespace = withoutWhitespace;
|
|
5
8
|
exports.longestCommonPrefix = longestCommonPrefix;
|
|
6
9
|
exports.joinWithLast = joinWithLast;
|
|
10
|
+
exports.isAbsolutePath = isAbsolutePath;
|
|
11
|
+
exports.dropRawStringSurround = dropRawStringSurround;
|
|
12
|
+
const path_1 = __importDefault(require("path"));
|
|
7
13
|
/**
|
|
8
14
|
* Check if the given string starts and ends with the given letter
|
|
9
15
|
*/
|
|
@@ -51,4 +57,33 @@ function joinWithLast(strs, { join = ', ', last = ', and ', joinTwo = ' and ' }
|
|
|
51
57
|
}
|
|
52
58
|
return strs.slice(0, -1).join(join) + last + strs[strs.length - 1];
|
|
53
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Check if the given path is an absolute path.
|
|
62
|
+
*/
|
|
63
|
+
function isAbsolutePath(p, regex) {
|
|
64
|
+
return regex?.test(p) || p.startsWith('/') || p.startsWith('\\') ||
|
|
65
|
+
/[a-zA-Z]:[\\/]/.test(p) || // Windows absolute path
|
|
66
|
+
path_1.default.normalize(p + '/') === path_1.default.normalize(path_1.default.resolve(p) + '/');
|
|
67
|
+
}
|
|
68
|
+
const CorrespondingClose = {
|
|
69
|
+
'(': ')',
|
|
70
|
+
'[': ']',
|
|
71
|
+
'{': '}'
|
|
72
|
+
};
|
|
73
|
+
/** collect '-' at the start until '[' or '(' is reached, then drop the same from the end if present otherwise return the value as is */
|
|
74
|
+
function dropRawStringSurround(value) {
|
|
75
|
+
const dashCount = value.match(/^-*/)?.[0].length ?? 0;
|
|
76
|
+
const open = value[dashCount];
|
|
77
|
+
if (open === '[' || open === '(' || open === '{') {
|
|
78
|
+
// if the value starts with a dash and then a bracket, we drop the dashes at the end
|
|
79
|
+
const end = value.endsWith(CorrespondingClose[open] + '-'.repeat(dashCount)) ? dashCount : undefined;
|
|
80
|
+
if (end !== undefined) {
|
|
81
|
+
return value.slice(dashCount + 1, -end - 1);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
return value;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return value;
|
|
88
|
+
}
|
|
54
89
|
//# sourceMappingURL=strings.js.map
|
package/util/version.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.flowrVersion = flowrVersion;
|
|
4
4
|
const semver_1 = require("semver");
|
|
5
5
|
// this is automatically replaced with the current version by release-it
|
|
6
|
-
const version = '2.
|
|
6
|
+
const version = '2.3.0';
|
|
7
7
|
function flowrVersion() {
|
|
8
8
|
return new semver_1.SemVer(version);
|
|
9
9
|
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { LintingResult } from '../linter-format';
|
|
2
|
-
import { LintingCertainty } from '../linter-format';
|
|
3
|
-
import type { MergeableRecord } from '../../util/objects';
|
|
4
|
-
import type { SourceRange } from '../../util/range';
|
|
5
|
-
import type { Identifier } from '../../dataflow/environments/identifier';
|
|
6
|
-
export interface DeprecatedFunctionsResult extends LintingResult {
|
|
7
|
-
function: string;
|
|
8
|
-
range: SourceRange;
|
|
9
|
-
}
|
|
10
|
-
export interface DeprecatedFunctionsConfig extends MergeableRecord {
|
|
11
|
-
/**
|
|
12
|
-
* The list of function names that should be marked as deprecated.
|
|
13
|
-
*/
|
|
14
|
-
deprecatedFunctions: string[];
|
|
15
|
-
}
|
|
16
|
-
export interface DeprecatedFunctionsMetadata extends MergeableRecord {
|
|
17
|
-
totalRelevant: number;
|
|
18
|
-
totalNotDeprecated: number;
|
|
19
|
-
}
|
|
20
|
-
export declare const R1_DEPRECATED_FUNCTIONS: {
|
|
21
|
-
readonly createSearch: (_config: DeprecatedFunctionsConfig) => import("../../search/flowr-search-builder").FlowrSearchBuilder<"all", ["with"], import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/search-executor/search-enrichers").EnrichedFlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>;
|
|
22
|
-
readonly processSearchResult: (elements: import("../../search/flowr-search").FlowrSearchElements<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../search/flowr-search").FlowrSearchElement<import("../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: DeprecatedFunctionsConfig) => {
|
|
23
|
-
results: {
|
|
24
|
-
certainty: LintingCertainty.Definitely;
|
|
25
|
-
function: Identifier;
|
|
26
|
-
range: SourceRange;
|
|
27
|
-
}[];
|
|
28
|
-
'.meta': DeprecatedFunctionsMetadata;
|
|
29
|
-
};
|
|
30
|
-
readonly prettyPrint: (result: DeprecatedFunctionsResult) => string;
|
|
31
|
-
readonly defaultConfig: {
|
|
32
|
-
readonly deprecatedFunctions: ["all_equal", "arrange_all", "distinct_all", "filter_all", "group_by_all", "summarise_all", "mutate_all", "select_all", "vars", "all_vars", "id", "failwith", "select_vars", "rename_vars", "select_var", "current_vars", "bench_tbls", "compare_tbls", "compare_tbls2", "eval_tbls", "eval_tbls2", "location", "changes", "combine", "do", "funs", "add_count_", "add_tally_", "arrange_", "count_", "distinct_", "do_", "filter_", "funs_", "group_by_", "group_indices_", "mutate_", "tally_", "transmute_", "rename_", "rename_vars_", "select_", "select_vars_", "slice_", "summarise_", "summarize_", "summarise_each", "src_local", "tbl_df", "add_rownames", "group_nest", "group_split", "with_groups", "nest_by", "progress_estimated", "recode", "sample_n", "top_n", "transmute", "fct_explicit_na", "aes_", "aes_auto", "annotation_logticks", "is.Coord", "coord_flip", "coord_map", "is.facet", "fortify", "is.ggproto", "guide_train", "is.ggplot", "qplot", "is.theme", "gg_dep", "liply", "isplit2", "list_along", "cross", "invoke", "at_depth", "prepend", "rerun", "splice", "`%@%`", "rbernoulli", "rdunif", "when", "update_list", "map_raw", "accumulate", "reduce_right", "flatten", "map_dfr", "as_vector", "transpose", "melt_delim", "melt_fwf", "melt_table", "read_table2", "str_interp", "as_tibble", "data_frame", "tibble_", "data_frame_", "lst_", "as_data_frame", "as.tibble", "frame_data", "trunc_mat", "is.tibble", "tidy_names", "set_tidy_names", "repair_names", "extract_numeric", "complete_", "drop_na_", "expand_", "crossing_", "nesting_", "extract_", "fill_", "gather_", "nest_", "separate_rows_", "separate_", "spread_", "unite_", "unnest_", "extract", "gather", "nest_legacy", "separate_rows", "separate", "spread"];
|
|
33
|
-
};
|
|
34
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.R1_DEPRECATED_FUNCTIONS = void 0;
|
|
4
|
-
const linter_format_1 = require("../linter-format");
|
|
5
|
-
const flowr_search_builder_1 = require("../../search/flowr-search-builder");
|
|
6
|
-
const dfg_1 = require("../../util/mermaid/dfg");
|
|
7
|
-
const search_enrichers_1 = require("../../search/search-executor/search-enrichers");
|
|
8
|
-
exports.R1_DEPRECATED_FUNCTIONS = {
|
|
9
|
-
createSearch: (_config) => flowr_search_builder_1.Q.all().with(search_enrichers_1.Enrichment.CallTargets),
|
|
10
|
-
processSearchResult: (elements, config) => {
|
|
11
|
-
const metadata = {
|
|
12
|
-
totalRelevant: 0,
|
|
13
|
-
totalNotDeprecated: 0
|
|
14
|
-
};
|
|
15
|
-
return {
|
|
16
|
-
results: elements.getElements()
|
|
17
|
-
.flatMap(element => {
|
|
18
|
-
const targets = (0, search_enrichers_1.enrichmentContent)(element, search_enrichers_1.Enrichment.CallTargets).targets;
|
|
19
|
-
// if there is a call target that is not built-in (ie a custom function), we don't want to mark it as deprecated
|
|
20
|
-
// eventually we'd want to solve this with an argument to the CallTargets enrichment like satisfiesCallTargets does!
|
|
21
|
-
if (targets.some(t => typeof t !== 'string')) {
|
|
22
|
-
return [];
|
|
23
|
-
}
|
|
24
|
-
return targets.map(target => {
|
|
25
|
-
metadata.totalRelevant++;
|
|
26
|
-
return {
|
|
27
|
-
range: element.node.info.fullRange,
|
|
28
|
-
target: target
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
})
|
|
32
|
-
.filter(element => {
|
|
33
|
-
if (config.deprecatedFunctions.includes(element.target)) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
metadata.totalNotDeprecated++;
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
.map(element => ({
|
|
42
|
-
certainty: linter_format_1.LintingCertainty.Definitely,
|
|
43
|
-
function: element.target,
|
|
44
|
-
range: element.range
|
|
45
|
-
})),
|
|
46
|
-
'.meta': metadata
|
|
47
|
-
};
|
|
48
|
-
},
|
|
49
|
-
prettyPrint: result => `Function \`${result.function}\` at ${(0, dfg_1.formatRange)(result.range)}`,
|
|
50
|
-
defaultConfig: {
|
|
51
|
-
deprecatedFunctions: ['all_equal', 'arrange_all', 'distinct_all', 'filter_all', 'group_by_all', 'summarise_all', 'mutate_all', 'select_all', 'vars', 'all_vars', 'id', 'failwith', 'select_vars', 'rename_vars', 'select_var', 'current_vars', 'bench_tbls', 'compare_tbls', 'compare_tbls2', 'eval_tbls', 'eval_tbls2', 'location', 'changes', 'combine', 'do', 'funs', 'add_count_', 'add_tally_', 'arrange_', 'count_', 'distinct_', 'do_', 'filter_', 'funs_', 'group_by_', 'group_indices_', 'mutate_', 'tally_', 'transmute_', 'rename_', 'rename_vars_', 'select_', 'select_vars_', 'slice_', 'summarise_', 'summarize_', 'summarise_each', 'src_local', 'tbl_df', 'add_rownames', 'group_nest', 'group_split', 'with_groups', 'nest_by', 'progress_estimated', 'recode', 'sample_n', 'top_n', 'transmute', 'fct_explicit_na', 'aes_', 'aes_auto', 'annotation_logticks', 'is.Coord', 'coord_flip', 'coord_map', 'is.facet', 'fortify', 'is.ggproto', 'guide_train', 'is.ggplot', 'qplot', 'is.theme', 'gg_dep', 'liply', 'isplit2', 'list_along', 'cross', 'invoke', 'at_depth', 'prepend', 'rerun', 'splice', '`%@%`', 'rbernoulli', 'rdunif', 'when', 'update_list', 'map_raw', 'accumulate', 'reduce_right', 'flatten', 'map_dfr', 'as_vector', 'transpose', 'melt_delim', 'melt_fwf', 'melt_table', 'read_table2', 'str_interp', 'as_tibble', 'data_frame', 'tibble_', 'data_frame_', 'lst_', 'as_data_frame', 'as.tibble', 'frame_data', 'trunc_mat', 'is.tibble', 'tidy_names', 'set_tidy_names', 'repair_names', 'extract_numeric', 'complete_', 'drop_na_', 'expand_', 'crossing_', 'nesting_', 'extract_', 'fill_', 'gather_', 'nest_', 'separate_rows_', 'separate_', 'spread_', 'unite_', 'unnest_', 'extract', 'gather', 'nest_legacy', 'separate_rows', 'separate', 'spread',]
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
//# sourceMappingURL=1-deprecated-functions.js.map
|
package/util/cfg/cfg.d.ts
DELETED
|
File without changes
|
package/util/cfg/cfg.js
DELETED