@eagleoutice/flowr 2.8.3 → 2.8.4

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 (37) hide show
  1. package/cli/repl/core.js +22 -0
  2. package/config.d.ts +14 -0
  3. package/config.js +10 -2
  4. package/control-flow/extract-cfg.js +35 -14
  5. package/core/print/slice-diff-ansi.js +1 -1
  6. package/dataflow/extractor.js +2 -2
  7. package/dataflow/graph/graph.js +0 -4
  8. package/dataflow/instrument/instrument-dataflow-count.d.ts +9 -0
  9. package/dataflow/instrument/instrument-dataflow-count.js +22 -0
  10. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +14 -7
  11. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +4 -2
  12. package/documentation/wiki-interface.js +3 -1
  13. package/documentation/wiki-query.js +1 -1
  14. package/linter/rules/unused-definition.js +6 -5
  15. package/package.json +1 -1
  16. package/project/context/flowr-analyzer-files-context.d.ts +1 -0
  17. package/project/context/flowr-file.d.ts +2 -0
  18. package/project/context/flowr-file.js +2 -0
  19. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.d.ts +24 -0
  20. package/project/plugins/file-plugins/flowr-analyzer-license-file-plugin.js +37 -0
  21. package/project/plugins/flowr-analyzer-plugin-defaults.js +2 -0
  22. package/project/plugins/plugin-registry.d.ts +2 -1
  23. package/project/plugins/plugin-registry.js +3 -1
  24. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +0 -1
  25. package/queries/catalog/config-query/config-query-format.d.ts +2 -2
  26. package/queries/catalog/config-query/config-query-format.js +40 -2
  27. package/queries/catalog/dependencies-query/function-info/read-functions.js +8 -0
  28. package/queries/catalog/dependencies-query/function-info/write-functions.js +9 -0
  29. package/queries/query.d.ts +1 -1
  30. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +481 -447
  31. package/r-bridge/roxygen2/documentation-provider.js +3 -1
  32. package/r-bridge/roxygen2/roxygen-parse.d.ts +1 -1
  33. package/r-bridge/roxygen2/roxygen-parse.js +9 -5
  34. package/util/r-version.js +17 -1
  35. package/util/range.d.ts +1 -1
  36. package/util/range.js +1 -1
  37. package/util/version.js +1 -1
@@ -41,12 +41,14 @@ function getDocumentationOf(nodeId, idMap) {
41
41
  if (!node) {
42
42
  return undefined;
43
43
  }
44
- else if (node.info.doc) {
44
+ else if ('doc' in node.info) {
45
45
  return node.info.doc;
46
46
  }
47
47
  const retriever = CommentRetriever[node.type] ?? ((c, a) => (0, roxygen_parse_1.parseRoxygenCommentsOfNode)(c, a)?.tags);
48
48
  const doc = retriever(node, idMap);
49
49
  if (doc) {
50
+ // to avoid endless recursion, we block the caching here once:
51
+ node.info.doc = undefined;
50
52
  // cache the documentation for future queries
51
53
  const expanded = expandInheritsOfTags(doc, idMap);
52
54
  node.info.doc = expanded;
@@ -22,5 +22,5 @@ type TagLine = [tag: string, remTagLine?: string];
22
22
  * @see {@link parseRoxygenCommentsOfNode} - to parse comments attached to a node
23
23
  */
24
24
  export declare function parseRoxygenComment(commentText: readonly string[]): RoxygenTag[];
25
- export declare const firstAndRest: (firstName: string, secondName: string) => (s: RoxygenParseContext, t: TagLine) => void;
25
+ export declare const firstAndRest: (firstName: string, secondName: string) => (s: RoxygenParseContext, t: TagLine) => TagLine | undefined;
26
26
  export {};
@@ -49,7 +49,7 @@ function parseRoxygenCommentsOfNode(node, idMap) {
49
49
  attachedTo: cur?.info.id,
50
50
  requestNode: node.info.id,
51
51
  range: [
52
- ...(0, range_1.mergeRanges)(...comments.map(c => c.location)),
52
+ ...(0, range_1.mergeRanges)(comments.map(c => c.location)),
53
53
  comments.find(c => c.info.file)?.info.file
54
54
  ]
55
55
  };
@@ -66,7 +66,10 @@ function parseRoxygenComment(commentText) {
66
66
  tags: [],
67
67
  idx: 0
68
68
  };
69
- val(state, [roxygen_ast_1.KnownRoxygenTags.Text]);
69
+ let tag = val(state, [roxygen_ast_1.KnownRoxygenTags.Text]);
70
+ while (tag) {
71
+ tag = parseRoxygenTag(state, tag);
72
+ }
70
73
  return state.tags;
71
74
  }
72
75
  function atEnd(state) {
@@ -125,7 +128,7 @@ function val(state, tagName, lineToVal = l => l.join('\n').trim()) {
125
128
  });
126
129
  }
127
130
  }
128
- parseRoxygenTag(state, nextTag);
131
+ return nextTag;
129
132
  }
130
133
  const spaceVals = (s, t) => val(s, t, l => (0, args_1.splitAtEscapeSensitive)(l.join(' ')));
131
134
  const flagVal = (s, t) => val(s, t, () => undefined);
@@ -206,11 +209,12 @@ const TagMap = {
206
209
  content: l.join(' ')
207
210
  }))
208
211
  };
212
+ /** returns the next tag */
209
213
  function parseRoxygenTag(state, tagName) {
210
214
  if (tagName === undefined) {
211
- return;
215
+ return undefined;
212
216
  }
213
217
  const parser = TagMap[tagName[0]] ?? val;
214
- parser(state, tagName);
218
+ return parser(state, tagName);
215
219
  }
216
220
  //# sourceMappingURL=roxygen-parse.js.map
package/util/r-version.js CHANGED
@@ -9,6 +9,18 @@ function makeVersion(version, original) {
9
9
  semver.str = original;
10
10
  return semver;
11
11
  }
12
+ function tryNormalizeNumberPart(part) {
13
+ try {
14
+ const res = Number(part);
15
+ if (!Number.isNaN(res)) {
16
+ return String(res);
17
+ }
18
+ }
19
+ catch {
20
+ return part;
21
+ }
22
+ return part;
23
+ }
12
24
  function normalizeVersion(version) {
13
25
  version = version.trim();
14
26
  let comparator = '';
@@ -29,7 +41,11 @@ function normalizeVersion(version) {
29
41
  mainVersionParts.push('0');
30
42
  }
31
43
  }
32
- return comparator + mainVersionParts.map(n => String(Number(n))).join('.') + (preReleaseParts.length > 0 ? `-${preReleaseParts.join('-')}` : '');
44
+ let prerelease = '';
45
+ if (preReleaseParts.length > 0) {
46
+ prerelease = '-' + preReleaseParts.join('-').split('.').map(part => tryNormalizeNumberPart(part)).join('.');
47
+ }
48
+ return comparator + mainVersionParts.map(tryNormalizeNumberPart).join('.') + prerelease;
33
49
  }
34
50
  const AnyVerWithMaybeRangeRegex = /(\s*[<>=~^]*\s*\d+(\.\d*)*(-[0-9A-Za-z-.]+)?)/g;
35
51
  function normalizeVersions(versions) {
package/util/range.d.ts CHANGED
@@ -52,7 +52,7 @@ export declare function invalidRange(): SourceRange;
52
52
  * If you are interested in combining overlapping ranges into a minimal set of ranges, see {@link combineRanges}.
53
53
  * @throws if no ranges are provided
54
54
  */
55
- export declare function mergeRanges(...rs: (SourceRange | undefined)[]): SourceRange;
55
+ export declare function mergeRanges(rs?: (SourceRange | undefined)[]): SourceRange;
56
56
  /**
57
57
  * @returns true iff `r1` starts and ends before `r2` starts (i.e., if `r1` and `r2` do not overlap and `r1` comes before `r2`
58
58
  */
package/util/range.js CHANGED
@@ -45,7 +45,7 @@ function invalidRange() {
45
45
  * If you are interested in combining overlapping ranges into a minimal set of ranges, see {@link combineRanges}.
46
46
  * @throws if no ranges are provided
47
47
  */
48
- function mergeRanges(...rs) {
48
+ function mergeRanges(rs = []) {
49
49
  const rsSafe = rs.filter(assert_1.isNotUndefined);
50
50
  (0, assert_1.guard)(rsSafe.length > 0, 'Cannot merge no ranges');
51
51
  return rsSafe.reduce(([sl, sc, el, ec], [nsl, nsc, nel, nec]) => [
package/util/version.js CHANGED
@@ -6,7 +6,7 @@ exports.printVersionInformation = printVersionInformation;
6
6
  const semver_1 = require("semver");
7
7
  const assert_1 = require("./assert");
8
8
  // this is automatically replaced with the current version by release-it
9
- const version = '2.8.3';
9
+ const version = '2.8.4';
10
10
  /**
11
11
  * Retrieves the current flowR version as a new {@link SemVer} object.
12
12
  */