@eagleoutice/flowr 2.13.9 → 2.13.10

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 (138) hide show
  1. package/config.d.ts +50 -2
  2. package/config.js +37 -6
  3. package/dataflow/environments/apply-kill.js +4 -4
  4. package/dataflow/environments/built-in-props.d.ts +28 -4
  5. package/dataflow/environments/built-in-props.js +31 -8
  6. package/dataflow/environments/built-in.d.ts +7 -2
  7. package/dataflow/environments/built-in.js +10 -12
  8. package/dataflow/environments/default-builtin-config.d.ts +46 -6
  9. package/dataflow/environments/default-builtin-config.js +30 -16
  10. package/dataflow/environments/environment.d.ts +16 -0
  11. package/dataflow/environments/environment.js +70 -18
  12. package/dataflow/environments/identifier.d.ts +6 -0
  13. package/dataflow/environments/identifier.js +18 -5
  14. package/dataflow/environments/query-fn-props.js +34 -2
  15. package/dataflow/environments/reference-to-maybe.js +1 -1
  16. package/dataflow/eval/resolve/alias-tracking.js +45 -1
  17. package/dataflow/eval/resolve/resolve-argument.js +25 -17
  18. package/dataflow/eval/resolve/resolve-strings.d.ts +17 -0
  19. package/dataflow/eval/resolve/resolve-strings.js +16 -9
  20. package/dataflow/eval/resolve/resolve.js +3 -1
  21. package/dataflow/graph/call-graph.d.ts +7 -0
  22. package/dataflow/graph/call-graph.js +103 -0
  23. package/dataflow/graph/df-helper.d.ts +2 -0
  24. package/dataflow/graph/graph.d.ts +5 -8
  25. package/dataflow/internal/linker.d.ts +5 -5
  26. package/dataflow/internal/linker.js +31 -92
  27. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -2
  28. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +3 -9
  29. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +4 -30
  30. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -1
  31. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +1 -1
  32. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +7 -1
  33. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +3 -3
  34. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.d.ts +1 -1
  35. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +5 -1
  36. package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +2 -2
  37. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +5 -6
  38. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +32 -14
  39. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +16 -4
  40. package/dataflow/internal/process/functions/call/known-call-handling.js +29 -8
  41. package/documentation/doc-util/doc-sigdb.d.ts +9 -0
  42. package/documentation/doc-util/doc-sigdb.js +32 -0
  43. package/documentation/wiki-interface.js +13 -2
  44. package/documentation/wiki-query.js +3 -0
  45. package/documentation/wiki-signature-database.js +2 -5
  46. package/gas.d.ts +6 -0
  47. package/gas.js +7 -1
  48. package/package.json +1 -1
  49. package/project/attached-packages.d.ts +13 -0
  50. package/project/attached-packages.js +30 -0
  51. package/project/context/flowr-analyzer-context.d.ts +15 -0
  52. package/project/context/flowr-analyzer-context.js +14 -3
  53. package/project/context/flowr-analyzer-files-context.d.ts +11 -0
  54. package/project/context/flowr-analyzer-files-context.js +3 -0
  55. package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +4 -0
  56. package/project/context/flowr-analyzer-incremental-analysis-context.js +69 -0
  57. package/project/dependency-version-space.d.ts +33 -11
  58. package/project/dependency-version-space.js +58 -32
  59. package/project/plugins/file-plugins/files/flowr-namespace-file.js +52 -24
  60. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.d.ts +22 -0
  61. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.js +101 -0
  62. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +30 -11
  63. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +79 -37
  64. package/project/plugins/plugin-registry.d.ts +2 -1
  65. package/project/plugins/plugin-registry.js +2 -0
  66. package/project/sigdb/manifest.js +9 -5
  67. package/project/sigdb/signature-match.d.ts +5 -18
  68. package/project/sigdb/signature-match.js +5 -18
  69. package/queries/catalog/call-graph-query/call-graph-query-executor.js +3 -1
  70. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +4 -0
  71. package/queries/catalog/call-graph-query/call-graph-query-format.js +4 -0
  72. package/queries/catalog/dependencies-query/dependencies-query-executor.js +10 -3
  73. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +19 -1
  74. package/queries/catalog/dependencies-query/dependencies-query-format.js +22 -2
  75. package/queries/catalog/dependencies-query/function-info/library-functions.js +7 -1
  76. package/queries/catalog/dependencies-query/function-info/read-functions.js +5 -5
  77. package/queries/catalog/dependencies-query/function-info/remote-functions.d.ts +18 -0
  78. package/queries/catalog/dependencies-query/function-info/remote-functions.js +46 -0
  79. package/queries/catalog/dependencies-query/function-info/visualize-functions.js +52 -2
  80. package/queries/catalog/dependencies-query/function-info/write-functions.js +8 -4
  81. package/queries/catalog/dependencies-query/link-devices.d.ts +12 -0
  82. package/queries/catalog/dependencies-query/link-devices.js +58 -0
  83. package/queries/catalog/dice-query/dice-query-format.d.ts +2 -0
  84. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +25 -6
  85. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +37 -6
  86. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +17 -4
  87. package/queries/catalog/input-sources-query/input-sources-query-format.js +4 -0
  88. package/queries/catalog/input-sources-query/input-types.d.ts +10 -0
  89. package/queries/catalog/input-sources-query/input-types.js +10 -0
  90. package/queries/catalog/location-map-query/location-map-query-executor.js +16 -6
  91. package/queries/catalog/location-map-query/location-map-query-format.d.ts +15 -1
  92. package/queries/catalog/location-map-query/location-map-query-format.js +22 -5
  93. package/queries/catalog/signature-query/signature-query-executor.js +3 -0
  94. package/queries/catalog/signature-query/signature-query-format.d.ts +5 -0
  95. package/queries/query.d.ts +1 -1
  96. package/r-bridge/lang-4.x/ast/model/model.d.ts +14 -2
  97. package/r-bridge/lang-4.x/ast/model/model.js +32 -0
  98. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +2 -0
  99. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +2 -0
  100. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +2 -0
  101. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -0
  102. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -0
  103. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -0
  104. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +2 -0
  105. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +7 -8
  106. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +9 -46
  107. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -0
  108. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +2 -0
  109. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -0
  110. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -0
  111. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -0
  112. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +2 -0
  113. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -0
  114. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -0
  115. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +2 -0
  116. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +2 -0
  117. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -0
  118. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +2 -0
  119. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -0
  120. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +0 -5
  121. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +6 -3
  122. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +1 -1
  123. package/search/flowr-search-filters.d.ts +17 -1
  124. package/search/flowr-search-filters.js +23 -0
  125. package/slicing/criterion/parse.d.ts +5 -25
  126. package/slicing/criterion/parse.js +15 -20
  127. package/slicing/static/fingerprint.js +18 -6
  128. package/slicing/static/slicer-types.d.ts +10 -0
  129. package/slicing/static/static-slicer.d.ts +1 -1
  130. package/slicing/static/static-slicer.js +29 -6
  131. package/slicing/static/visiting-queue.d.ts +12 -2
  132. package/slicing/static/visiting-queue.js +28 -3
  133. package/util/arg-matching.d.ts +18 -0
  134. package/util/arg-matching.js +70 -0
  135. package/util/r-regex.js +19 -1
  136. package/util/range.d.ts +7 -8
  137. package/util/range.js +10 -11
  138. package/util/version.js +1 -1
@@ -0,0 +1,18 @@
1
+ /** the name of the special `...` parameter which collects everything that finds no formal of its own */
2
+ export declare const DotsParameterName = "...";
3
+ /**
4
+ * Bind the arguments of a call to the formal parameters of the called function, following R's argument matching
5
+ * rules (see https://cran.r-project.org/doc/manuals/R-lang.html#Argument-matching):
6
+ *
7
+ * 1. every named argument that *exactly* matches a formal takes it,
8
+ * 2. every remaining named argument that is a *unique prefix* of a still-free formal takes it (`pmatch`),
9
+ * 3. the remaining unnamed arguments fill the still-free formals from left to right, stopping at `...`
10
+ * (formals behind `...` can only be matched by name), and
11
+ * 4. everything that is still unmatched goes to `...` if the function has one.
12
+ *
13
+ * Both sides are given by their names alone (`undefined` for an unnamed argument or an anonymous formal), so this
14
+ * works for the normalized AST, the dataflow graph, and a plain signature list alike. An empty argument (`f(1, ,3)`)
15
+ * is an unnamed one: it takes its formal like any other, the caller just has nothing to bind to it.
16
+ * @returns for every argument (by index) the index of the parameter it binds to, `undefined` if it stays unbound
17
+ */
18
+ export declare function matchArgumentsToParameters(argNames: readonly (string | undefined)[], paramNames: readonly (string | undefined)[]): readonly (number | undefined)[];
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DotsParameterName = void 0;
4
+ exports.matchArgumentsToParameters = matchArgumentsToParameters;
5
+ const prefix_1 = require("./prefix");
6
+ /** the name of the special `...` parameter which collects everything that finds no formal of its own */
7
+ exports.DotsParameterName = '...';
8
+ /**
9
+ * Bind the arguments of a call to the formal parameters of the called function, following R's argument matching
10
+ * rules (see https://cran.r-project.org/doc/manuals/R-lang.html#Argument-matching):
11
+ *
12
+ * 1. every named argument that *exactly* matches a formal takes it,
13
+ * 2. every remaining named argument that is a *unique prefix* of a still-free formal takes it (`pmatch`),
14
+ * 3. the remaining unnamed arguments fill the still-free formals from left to right, stopping at `...`
15
+ * (formals behind `...` can only be matched by name), and
16
+ * 4. everything that is still unmatched goes to `...` if the function has one.
17
+ *
18
+ * Both sides are given by their names alone (`undefined` for an unnamed argument or an anonymous formal), so this
19
+ * works for the normalized AST, the dataflow graph, and a plain signature list alike. An empty argument (`f(1, ,3)`)
20
+ * is an unnamed one: it takes its formal like any other, the caller just has nothing to bind to it.
21
+ * @returns for every argument (by index) the index of the parameter it binds to, `undefined` if it stays unbound
22
+ */
23
+ function matchArgumentsToParameters(argNames, paramNames) {
24
+ const bound = Array.from(argNames, () => undefined);
25
+ const names = paramNames.map(p => p ?? '');
26
+ const dots = names.indexOf(exports.DotsParameterName);
27
+ const taken = new Set();
28
+ const take = (arg, param) => {
29
+ bound[arg] = param;
30
+ taken.add(param);
31
+ };
32
+ /** binds each still-free named argument to the formal `pick` names for it, as long as that one is still free too */
33
+ const byName = (pick) => {
34
+ for (let i = 0; i < argNames.length; i++) {
35
+ const name = argNames[i];
36
+ if (name === undefined || bound[i] !== undefined) {
37
+ continue;
38
+ }
39
+ const target = pick(name);
40
+ const param = target === undefined ? -1 : names.indexOf(target);
41
+ if (param >= 0 && !taken.has(param)) {
42
+ take(i, param);
43
+ }
44
+ }
45
+ };
46
+ byName(name => name); // (1) exact
47
+ byName(name => (0, prefix_1.findByPrefixIfUnique)(name, names)); // (2) pmatch
48
+ // (3) positional
49
+ let formal = 0;
50
+ for (let i = 0; i < argNames.length; i++) {
51
+ if (argNames[i] !== undefined || bound[i] !== undefined) {
52
+ continue;
53
+ }
54
+ while (taken.has(formal)) {
55
+ formal++;
56
+ }
57
+ if (formal >= names.length || formal === dots) {
58
+ break;
59
+ }
60
+ take(i, formal);
61
+ }
62
+ // (4) `...`
63
+ if (dots >= 0) {
64
+ for (let i = 0; i < argNames.length; i++) {
65
+ bound[i] ??= dots;
66
+ }
67
+ }
68
+ return bound;
69
+ }
70
+ //# sourceMappingURL=arg-matching.js.map
package/util/r-regex.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RPunctuationChars = exports.RStandardRegexp = void 0;
4
4
  exports.parseRRegexPattern = parseRRegexPattern;
5
+ const log_1 = require("./log");
5
6
  /**
6
7
  * Represents R's `.standard_regexps` definitions.
7
8
  * @see https://github.com/r-devel/r-svn/blob/44474af03ae77fd3b9a340279fa10cb698d106c3/src/library/base/R/utils.R#L52-L53
@@ -40,6 +41,10 @@ const PosixClassMap = {
40
41
  print: '\x20-\x7E'
41
42
  };
42
43
  const posixClassRegex = /\[:([a-z]+):]/g;
44
+ /** the flags R accepts inside the pattern (`(?i)foo`), which JavaScript only takes next to it */
45
+ const inlineFlags = /^\(\?([imsx]+)\)/;
46
+ /** what a pattern JavaScript cannot compile falls back to, so one bad pattern matches nothing rather than throwing */
47
+ const matchesNothing = /(?!)/;
43
48
  /**
44
49
  * Converts an R regex pattern (which may include POSIX character classes) into a JavaScript RegExp.
45
50
  */
@@ -52,6 +57,19 @@ function parseRRegexPattern(pattern) {
52
57
  if (convertedPattern.startsWith('*') || convertedPattern.startsWith('+')) {
53
58
  convertedPattern = '.' + convertedPattern;
54
59
  }
55
- return new RegExp(convertedPattern);
60
+ let flags = '';
61
+ const inline = inlineFlags.exec(convertedPattern);
62
+ if (inline) {
63
+ /* `x` (extended) has no counterpart, the others carry over by name */
64
+ flags = inline[1].replaceAll('x', '');
65
+ convertedPattern = convertedPattern.slice(inline[0].length);
66
+ }
67
+ try {
68
+ return new RegExp(convertedPattern, flags);
69
+ }
70
+ catch (e) {
71
+ log_1.log.warn(`R pattern ${JSON.stringify(pattern)} is no JavaScript regex, treating it as matching nothing: ${e.message}`);
72
+ return matchesNothing;
73
+ }
56
74
  }
57
75
  //# sourceMappingURL=r-regex.js.map
package/util/range.d.ts CHANGED
@@ -101,10 +101,8 @@ export declare const SourceRange: {
101
101
  * @returns true iff `r1` starts and ends before `r2` starts (i.e., if `r1` and `r2` do not overlap and `r1` comes before `r2`
102
102
  */
103
103
  readonly startsCompletelyBefore: (this: void, [, , r1el, r1ec]: SourceRange, [r2sl, r2sc, ,]: SourceRange) => boolean;
104
- /**
105
- * Checks if the two ranges overlap.
106
- */
107
- readonly overlap: (this: void, [r1sl, r1sc, r1el, r1ec]: SourceRange, [r2sl, r2sc, r2el, r2ec]: SourceRange) => boolean;
104
+ /** Checks if the two ranges overlap, i.e. whether neither of them lies completely before the other. */
105
+ readonly overlap: (this: void, r1: SourceRange, r2: SourceRange) => boolean;
108
106
  /**
109
107
  * Calculates the component-wise sum of two ranges.
110
108
  */
@@ -169,17 +167,18 @@ export declare const SourceLocation: {
169
167
  * Formats a {@link SourceLocation|source location} as a human-readable string.
170
168
  */
171
169
  readonly format: (this: void, location: SourceLocation | undefined) => string;
170
+ /** Returns the {@link SourceRange|source range} part of a {@link SourceLocation|source location}, file excluded. */
171
+ readonly getRange: (this: void, [sl, sc, el, ec]: SourceLocation) => SourceRange;
172
172
  /**
173
- * Returns the {@link SourceRange|source range} part of a {@link SourceLocation|source location}.
173
+ * Returns the file part of a {@link SourceLocation|source location}, or `undefined` if no file is set.
174
174
  */
175
- readonly getRange: (this: void, location: SourceLocation) => SourceRange;
176
175
  readonly getFile: (this: void, location: SourceLocation) => string | undefined;
177
176
  /**
178
- * Returns the file part of a {@link SourceLocation|source location}, or `undefined` if no file is set.
177
+ * Creates a {@link SourceLocation|source location} from a {@link SourceRange|source range} and a file name.
179
178
  */
180
179
  readonly from: (this: void, range: SourceRange, file?: string) => SourceLocation;
181
180
  /**
182
- * Creates a {@link SourceLocation|source location} from a {@link SourceRange|source range} and a file name.
181
+ * The {@link SourceLocation|source location} of an AST node, file included.
183
182
  * @returns undefined if the given range is undefined
184
183
  * @see {@link SourceRange.fromNode} for getting the range from an AST node
185
184
  */
package/util/range.js CHANGED
@@ -126,11 +126,9 @@ exports.SourceRange = {
126
126
  startsCompletelyBefore([, , r1el, r1ec], [r2sl, r2sc, ,]) {
127
127
  return r1el < r2sl || (r1el === r2sl && r1ec < r2sc);
128
128
  },
129
- /**
130
- * Checks if the two ranges overlap.
131
- */
132
- overlap([r1sl, r1sc, r1el, r1ec], [r2sl, r2sc, r2el, r2ec]) {
133
- return r1sl <= r2el && r2sl <= r1el && r1sc <= r2ec && r2sc <= r1ec;
129
+ /** Checks if the two ranges overlap, i.e. whether neither of them lies completely before the other. */
130
+ overlap(r1, r2) {
131
+ return !exports.SourceRange.startsCompletelyBefore(r1, r2) && !exports.SourceRange.startsCompletelyBefore(r2, r1);
134
132
  },
135
133
  /**
136
134
  * Calculates the component-wise sum of two ranges.
@@ -273,23 +271,24 @@ exports.SourceLocation = {
273
271
  return exports.SourceRange.format(location);
274
272
  }
275
273
  },
274
+ /** Returns the {@link SourceRange|source range} part of a {@link SourceLocation|source location}, file excluded. */
275
+ getRange([sl, sc, el, ec]) {
276
+ return [sl, sc, el, ec];
277
+ },
276
278
  /**
277
- * Returns the {@link SourceRange|source range} part of a {@link SourceLocation|source location}.
279
+ * Returns the file part of a {@link SourceLocation|source location}, or `undefined` if no file is set.
278
280
  */
279
- getRange(location) {
280
- return location;
281
- },
282
281
  getFile(location) {
283
282
  return location[4];
284
283
  },
285
284
  /**
286
- * Returns the file part of a {@link SourceLocation|source location}, or `undefined` if no file is set.
285
+ * Creates a {@link SourceLocation|source location} from a {@link SourceRange|source range} and a file name.
287
286
  */
288
287
  from(range, file) {
289
288
  return file !== undefined ? [...range, file] : range;
290
289
  },
291
290
  /**
292
- * Creates a {@link SourceLocation|source location} from a {@link SourceRange|source range} and a file name.
291
+ * The {@link SourceLocation|source location} of an AST node, file included.
293
292
  * @returns undefined if the given range is undefined
294
293
  * @see {@link SourceRange.fromNode} for getting the range from an AST node
295
294
  */
package/util/version.js CHANGED
@@ -42,7 +42,7 @@ const assert_1 = require("./assert");
42
42
  const sigdb_download_1 = require("../project/sigdb/sigdb-download");
43
43
  const doc_files_1 = require("../documentation/doc-util/doc-files");
44
44
  // this is automatically replaced with the current version by release-it
45
- const version = '2.13.9';
45
+ const version = '2.13.10';
46
46
  // this is automatically replaced with the release date by release-it (regex-bumper, see package.json)
47
47
  const versionDate = '2026-07-15T07:13:44Z';
48
48
  /**