@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.
Files changed (255) hide show
  1. package/README.md +226 -6
  2. package/abstract-interpretation/data-frame/absint-info.d.ts +109 -0
  3. package/abstract-interpretation/data-frame/absint-info.js +31 -0
  4. package/abstract-interpretation/data-frame/absint-visitor.d.ts +59 -0
  5. package/abstract-interpretation/data-frame/absint-visitor.js +173 -0
  6. package/abstract-interpretation/data-frame/domain.d.ts +107 -0
  7. package/abstract-interpretation/data-frame/domain.js +315 -0
  8. package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +17 -0
  9. package/abstract-interpretation/data-frame/mappers/access-mapper.js +166 -0
  10. package/abstract-interpretation/data-frame/mappers/arguments.d.ts +117 -0
  11. package/abstract-interpretation/data-frame/mappers/arguments.js +188 -0
  12. package/abstract-interpretation/data-frame/mappers/assignment-mapper.d.ts +20 -0
  13. package/abstract-interpretation/data-frame/mappers/assignment-mapper.js +34 -0
  14. package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +261 -0
  15. package/abstract-interpretation/data-frame/mappers/function-mapper.js +1219 -0
  16. package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +12 -0
  17. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +206 -0
  18. package/abstract-interpretation/data-frame/resolve-args.d.ts +42 -0
  19. package/abstract-interpretation/data-frame/resolve-args.js +118 -0
  20. package/abstract-interpretation/data-frame/semantics.d.ts +213 -0
  21. package/abstract-interpretation/data-frame/semantics.js +366 -0
  22. package/abstract-interpretation/data-frame/shape-inference.d.ts +38 -0
  23. package/abstract-interpretation/data-frame/shape-inference.js +117 -0
  24. package/benchmark/slicer.d.ts +18 -2
  25. package/benchmark/slicer.js +143 -5
  26. package/benchmark/stats/print.js +123 -45
  27. package/benchmark/stats/size-of.d.ts +7 -0
  28. package/benchmark/stats/size-of.js +1 -0
  29. package/benchmark/stats/stats.d.ts +30 -1
  30. package/benchmark/stats/stats.js +4 -2
  31. package/benchmark/summarizer/data.d.ts +33 -2
  32. package/benchmark/summarizer/first-phase/input.js +5 -1
  33. package/benchmark/summarizer/first-phase/process.d.ts +2 -1
  34. package/benchmark/summarizer/first-phase/process.js +49 -3
  35. package/benchmark/summarizer/second-phase/process.js +101 -3
  36. package/cli/benchmark-app.d.ts +2 -0
  37. package/cli/benchmark-app.js +5 -1
  38. package/cli/benchmark-helper-app.d.ts +2 -0
  39. package/cli/benchmark-helper-app.js +13 -8
  40. package/cli/common/options.js +4 -0
  41. package/cli/export-quads-app.js +2 -1
  42. package/cli/flowr.js +58 -57
  43. package/cli/repl/commands/repl-cfg.js +13 -13
  44. package/cli/repl/commands/repl-commands.js +2 -2
  45. package/cli/repl/commands/repl-dataflow.js +10 -10
  46. package/cli/repl/commands/repl-execute.d.ts +2 -3
  47. package/cli/repl/commands/repl-execute.js +4 -4
  48. package/cli/repl/commands/repl-lineage.js +4 -4
  49. package/cli/repl/commands/repl-main.d.ts +12 -1
  50. package/cli/repl/commands/repl-normalize.js +6 -6
  51. package/cli/repl/commands/repl-parse.js +2 -2
  52. package/cli/repl/commands/repl-query.js +9 -9
  53. package/cli/repl/commands/repl-version.js +1 -1
  54. package/cli/repl/core.d.ts +5 -2
  55. package/cli/repl/core.js +10 -8
  56. package/cli/repl/server/connection.d.ts +3 -1
  57. package/cli/repl/server/connection.js +7 -5
  58. package/cli/repl/server/server.d.ts +3 -2
  59. package/cli/repl/server/server.js +4 -2
  60. package/cli/script-core/statistics-core.d.ts +2 -1
  61. package/cli/script-core/statistics-core.js +2 -2
  62. package/cli/script-core/statistics-helper-core.d.ts +2 -1
  63. package/cli/script-core/statistics-helper-core.js +5 -4
  64. package/cli/slicer-app.js +4 -2
  65. package/cli/statistics-app.js +2 -1
  66. package/cli/statistics-helper-app.js +2 -1
  67. package/config.d.ts +43 -10
  68. package/config.js +47 -43
  69. package/control-flow/cfg-dead-code.js +45 -2
  70. package/control-flow/cfg-simplification.d.ts +2 -0
  71. package/control-flow/control-flow-graph.d.ts +2 -0
  72. package/control-flow/control-flow-graph.js +8 -0
  73. package/control-flow/dfg-cfg-guided-visitor.d.ts +5 -3
  74. package/control-flow/dfg-cfg-guided-visitor.js +15 -4
  75. package/control-flow/extract-cfg.d.ts +4 -2
  76. package/control-flow/extract-cfg.js +4 -3
  77. package/control-flow/semantic-cfg-guided-visitor.d.ts +20 -2
  78. package/control-flow/semantic-cfg-guided-visitor.js +24 -4
  79. package/core/pipeline-executor.d.ts +4 -1
  80. package/core/pipeline-executor.js +6 -5
  81. package/core/steps/all/core/10-normalize.d.ts +2 -0
  82. package/core/steps/all/core/10-normalize.js +1 -1
  83. package/core/steps/all/core/11-normalize-tree-sitter.d.ts +2 -1
  84. package/core/steps/all/core/11-normalize-tree-sitter.js +2 -2
  85. package/core/steps/all/core/20-dataflow.d.ts +2 -1
  86. package/core/steps/all/core/20-dataflow.js +2 -2
  87. package/core/steps/all/static-slicing/00-slice.d.ts +2 -1
  88. package/core/steps/all/static-slicing/00-slice.js +2 -2
  89. package/core/steps/pipeline/default-pipelines.d.ts +32 -31
  90. package/core/steps/pipeline/default-pipelines.js +8 -8
  91. package/core/steps/pipeline-step.d.ts +2 -1
  92. package/dataflow/environments/built-in-config.d.ts +3 -3
  93. package/dataflow/environments/built-in.d.ts +11 -3
  94. package/dataflow/environments/built-in.js +5 -3
  95. package/dataflow/environments/default-builtin-config.js +4 -2
  96. package/dataflow/environments/define.d.ts +2 -1
  97. package/dataflow/environments/define.js +4 -5
  98. package/dataflow/environments/remove.d.ts +6 -0
  99. package/dataflow/environments/remove.js +29 -0
  100. package/dataflow/eval/resolve/alias-tracking.d.ts +7 -2
  101. package/dataflow/eval/resolve/alias-tracking.js +11 -8
  102. package/dataflow/eval/resolve/resolve-argument.d.ts +8 -0
  103. package/dataflow/eval/resolve/resolve-argument.js +118 -0
  104. package/dataflow/eval/resolve/resolve.d.ts +65 -18
  105. package/dataflow/eval/resolve/resolve.js +144 -48
  106. package/dataflow/eval/values/string/string-constants.d.ts +1 -1
  107. package/dataflow/eval/values/string/string-constants.js +7 -2
  108. package/dataflow/extractor.d.ts +2 -1
  109. package/dataflow/extractor.js +2 -1
  110. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +5 -6
  111. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +1 -1
  112. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +4 -2
  113. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +11 -11
  114. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +10 -11
  115. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +7 -2
  116. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -3
  117. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +1 -1
  118. package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
  119. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -3
  120. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +6 -3
  121. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +19 -15
  122. package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -2
  123. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +1 -1
  124. package/dataflow/internal/process/functions/call/common.js +1 -1
  125. package/dataflow/internal/process/functions/process-parameter.js +1 -1
  126. package/dataflow/origin/dfg-get-symbol-refs.d.ts +21 -0
  127. package/dataflow/origin/dfg-get-symbol-refs.js +50 -0
  128. package/dataflow/processor.d.ts +5 -0
  129. package/documentation/doc-util/doc-cfg.js +4 -3
  130. package/documentation/doc-util/doc-code.d.ts +1 -1
  131. package/documentation/doc-util/doc-dfg.js +3 -2
  132. package/documentation/doc-util/doc-functions.d.ts +24 -0
  133. package/documentation/doc-util/doc-functions.js +65 -0
  134. package/documentation/doc-util/doc-normalized-ast.js +3 -2
  135. package/documentation/doc-util/doc-print.d.ts +5 -0
  136. package/documentation/doc-util/doc-print.js +36 -0
  137. package/documentation/doc-util/doc-query.js +13 -2
  138. package/documentation/doc-util/doc-repl.js +2 -1
  139. package/documentation/doc-util/doc-search.js +3 -2
  140. package/documentation/doc-util/doc-types.d.ts +28 -6
  141. package/documentation/doc-util/doc-types.js +89 -45
  142. package/documentation/print-cfg-wiki.js +6 -7
  143. package/documentation/print-core-wiki.js +5 -5
  144. package/documentation/print-dataflow-graph-wiki.js +10 -10
  145. package/documentation/print-engines-wiki.js +1 -2
  146. package/documentation/print-faq-wiki.js +8 -2
  147. package/documentation/print-interface-wiki.js +12 -2
  148. package/documentation/print-linter-issue.d.ts +1 -0
  149. package/documentation/print-linter-issue.js +71 -0
  150. package/documentation/print-linter-wiki.js +223 -34
  151. package/documentation/print-linting-and-testing-wiki.js +2 -4
  152. package/documentation/print-normalized-ast-wiki.js +3 -3
  153. package/documentation/print-query-wiki.js +18 -2
  154. package/documentation/print-readme.js +24 -1
  155. package/documentation/print-search-wiki.js +1 -2
  156. package/linter/linter-executor.d.ts +3 -1
  157. package/linter/linter-executor.js +3 -2
  158. package/linter/linter-format.d.ts +67 -7
  159. package/linter/linter-format.js +12 -1
  160. package/linter/linter-rules.d.ts +178 -16
  161. package/linter/linter-rules.js +14 -4
  162. package/linter/linter-tags.d.ts +80 -0
  163. package/linter/linter-tags.js +85 -0
  164. package/linter/rules/absolute-path.d.ts +71 -0
  165. package/linter/rules/absolute-path.js +177 -0
  166. package/linter/rules/dataframe-access-validation.d.ts +53 -0
  167. package/linter/rules/dataframe-access-validation.js +116 -0
  168. package/linter/rules/deprecated-functions.d.ts +43 -0
  169. package/linter/rules/deprecated-functions.js +58 -0
  170. package/linter/rules/{2-file-path-validity.d.ts → file-path-validity.d.ts} +16 -6
  171. package/linter/rules/{2-file-path-validity.js → file-path-validity.js} +21 -13
  172. package/linter/rules/naming-convention.d.ts +71 -0
  173. package/linter/rules/naming-convention.js +168 -0
  174. package/linter/rules/seeded-randomness.d.ts +65 -0
  175. package/linter/rules/seeded-randomness.js +122 -0
  176. package/linter/rules/unused-definition.d.ts +41 -0
  177. package/linter/rules/unused-definition.js +105 -0
  178. package/package.json +5 -2
  179. package/queries/base-query-format.d.ts +2 -0
  180. package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
  181. package/queries/catalog/call-context-query/call-context-query-executor.js +2 -2
  182. package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
  183. package/queries/catalog/config-query/config-query-executor.d.ts +1 -1
  184. package/queries/catalog/config-query/config-query-executor.js +2 -3
  185. package/queries/catalog/control-flow-query/control-flow-query-executor.d.ts +1 -1
  186. package/queries/catalog/control-flow-query/control-flow-query-executor.js +2 -2
  187. package/queries/catalog/control-flow-query/control-flow-query-format.d.ts +1 -1
  188. package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
  189. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
  190. package/queries/catalog/dependencies-query/dependencies-query-executor.js +4 -116
  191. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -1
  192. package/queries/catalog/df-shape-query/df-shape-query-executor.d.ts +3 -0
  193. package/queries/catalog/df-shape-query/df-shape-query-executor.js +46 -0
  194. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +72 -0
  195. package/queries/catalog/df-shape-query/df-shape-query-format.js +31 -0
  196. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
  197. package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
  198. package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -1
  199. package/queries/catalog/linter-query/linter-query-executor.d.ts +1 -1
  200. package/queries/catalog/linter-query/linter-query-executor.js +2 -2
  201. package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
  202. package/queries/catalog/linter-query/linter-query-format.js +16 -12
  203. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
  204. package/queries/catalog/origin-query/origin-query-format.d.ts +1 -1
  205. package/queries/catalog/project-query/project-query-format.d.ts +1 -1
  206. package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +1 -1
  207. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
  208. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
  209. package/queries/catalog/search-query/search-query-executor.d.ts +1 -1
  210. package/queries/catalog/search-query/search-query-executor.js +2 -2
  211. package/queries/catalog/search-query/search-query-format.d.ts +1 -1
  212. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
  213. package/queries/catalog/static-slice-query/static-slice-query-executor.js +2 -2
  214. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
  215. package/queries/query.d.ts +76 -16
  216. package/queries/query.js +2 -0
  217. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +2 -1
  218. package/r-bridge/lang-4.x/ast/parser/json/parser.js +4 -2
  219. package/r-bridge/lang-4.x/convert-values.js +2 -1
  220. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +3 -1
  221. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +4 -4
  222. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +1 -1
  223. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +7 -5
  224. package/r-bridge/shell.d.ts +3 -2
  225. package/r-bridge/shell.js +4 -5
  226. package/search/flowr-search-builder.d.ts +6 -2
  227. package/search/flowr-search-builder.js +7 -0
  228. package/search/flowr-search-filters.d.ts +32 -8
  229. package/search/flowr-search-filters.js +42 -15
  230. package/search/flowr-search.d.ts +4 -0
  231. package/search/search-executor/search-enrichers.d.ts +7 -3
  232. package/search/search-executor/search-enrichers.js +29 -20
  233. package/search/search-executor/search-generators.js +1 -1
  234. package/search/search-executor/search-transformer.d.ts +2 -0
  235. package/search/search-executor/search-transformer.js +10 -1
  236. package/slicing/static/static-slicer.d.ts +1 -1
  237. package/slicing/static/static-slicer.js +2 -3
  238. package/statistics/statistics.d.ts +3 -1
  239. package/statistics/statistics.js +5 -4
  240. package/util/containers.d.ts +12 -9
  241. package/util/containers.js +12 -9
  242. package/util/files.d.ts +8 -2
  243. package/util/files.js +22 -4
  244. package/util/objects.d.ts +5 -4
  245. package/util/r-value.d.ts +23 -0
  246. package/util/r-value.js +113 -0
  247. package/util/range.d.ts +5 -1
  248. package/util/range.js +11 -3
  249. package/util/text/strings.d.ts +6 -0
  250. package/util/text/strings.js +35 -0
  251. package/util/version.js +1 -1
  252. package/linter/rules/1-deprecated-functions.d.ts +0 -34
  253. package/linter/rules/1-deprecated-functions.js +0 -54
  254. package/util/cfg/cfg.d.ts +0 -0
  255. 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;
@@ -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
- (0, assert_1.guard)(rs.length > 0, 'Cannot merge no ranges');
31
- return rs.reduce(([sl, sc, el, ec], [nsl, nsc, nel, nec]) => [
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
- ], rs[0]);
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
@@ -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;
@@ -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.2.15';
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
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=cfg.js.map