@eagleoutice/flowr 2.7.0 → 2.7.2

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 (149) hide show
  1. package/README.md +20 -20
  2. package/abstract-interpretation/absint-visitor.d.ts +160 -0
  3. package/abstract-interpretation/absint-visitor.js +279 -0
  4. package/abstract-interpretation/data-frame/dataframe-domain.d.ts +2 -2
  5. package/abstract-interpretation/data-frame/dataframe-domain.js +23 -7
  6. package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +6 -6
  7. package/abstract-interpretation/data-frame/mappers/access-mapper.js +10 -14
  8. package/abstract-interpretation/data-frame/mappers/arguments.d.ts +10 -9
  9. package/abstract-interpretation/data-frame/mappers/arguments.js +7 -4
  10. package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +17 -17
  11. package/abstract-interpretation/data-frame/mappers/function-mapper.js +45 -50
  12. package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +7 -7
  13. package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +25 -29
  14. package/abstract-interpretation/data-frame/semantics.js +2 -3
  15. package/abstract-interpretation/data-frame/shape-inference.d.ts +52 -28
  16. package/abstract-interpretation/data-frame/shape-inference.js +67 -90
  17. package/abstract-interpretation/domains/bounded-set-domain.d.ts +2 -2
  18. package/abstract-interpretation/domains/interval-domain.d.ts +2 -2
  19. package/abstract-interpretation/domains/set-range-domain.d.ts +10 -4
  20. package/abstract-interpretation/domains/set-range-domain.js +7 -1
  21. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +2 -2
  22. package/abstract-interpretation/domains/singleton-domain.d.ts +2 -2
  23. package/benchmark/slicer.js +13 -14
  24. package/cli/common/options.d.ts +431 -8
  25. package/cli/common/options.js +1 -1
  26. package/cli/common/scripts-info.d.ts +431 -7
  27. package/cli/flowr-main-options.d.ts +102 -2
  28. package/cli/flowr.d.ts +102 -2
  29. package/cli/repl/commands/repl-commands.d.ts +25 -0
  30. package/cli/repl/commands/repl-query.js +17 -5
  31. package/cli/wiki.d.ts +13 -0
  32. package/cli/wiki.js +7 -2
  33. package/config.d.ts +4 -4
  34. package/config.js +1 -1
  35. package/control-flow/basic-cfg-guided-visitor.js +7 -8
  36. package/control-flow/control-flow-graph.d.ts +1 -1
  37. package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
  38. package/control-flow/semantic-cfg-guided-visitor.js +1 -1
  39. package/dataflow/eval/resolve/alias-tracking.js +1 -1
  40. package/dataflow/internal/linker.d.ts +2 -0
  41. package/dataflow/internal/linker.js +10 -12
  42. package/documentation/doc-capabilities.d.ts +1 -1
  43. package/documentation/doc-readme.d.ts +1 -1
  44. package/documentation/doc-util/doc-cfg.js +1 -1
  45. package/documentation/doc-util/doc-cli-option.d.ts +6 -6
  46. package/documentation/doc-util/doc-cli-option.js +3 -3
  47. package/documentation/doc-util/doc-dfg.d.ts +1 -1
  48. package/documentation/doc-util/doc-files.d.ts +3 -0
  49. package/documentation/doc-util/doc-files.js +4 -1
  50. package/documentation/doc-util/doc-normalized-ast.js +2 -2
  51. package/documentation/issue-linting-rule.d.ts +1 -1
  52. package/documentation/wiki-analyzer.d.ts +1 -1
  53. package/documentation/wiki-cfg.d.ts +1 -1
  54. package/documentation/wiki-core.d.ts +1 -1
  55. package/documentation/wiki-dataflow-graph.d.ts +1 -1
  56. package/documentation/wiki-dataflow-graph.js +6 -6
  57. package/documentation/wiki-engine.d.ts +1 -1
  58. package/documentation/wiki-engine.js +9 -10
  59. package/documentation/wiki-faq.d.ts +1 -1
  60. package/documentation/wiki-interface.d.ts +1 -1
  61. package/documentation/wiki-interface.js +12 -13
  62. package/documentation/wiki-linter.d.ts +1 -1
  63. package/documentation/wiki-linting-and-testing.d.ts +1 -1
  64. package/documentation/wiki-mk/doc-context.d.ts +54 -1
  65. package/documentation/wiki-mk/doc-context.js +17 -0
  66. package/documentation/wiki-mk/doc-maker.d.ts +5 -5
  67. package/documentation/wiki-mk/doc-maker.js +3 -1
  68. package/documentation/wiki-normalized-ast.d.ts +1 -1
  69. package/documentation/wiki-onboarding.d.ts +1 -1
  70. package/documentation/wiki-overview.d.ts +9 -0
  71. package/documentation/wiki-overview.js +248 -0
  72. package/documentation/wiki-query.d.ts +1 -1
  73. package/documentation/wiki-query.js +17 -1
  74. package/documentation/wiki-search.d.ts +1 -1
  75. package/documentation/wiki-setup.d.ts +9 -0
  76. package/documentation/wiki-setup.js +122 -0
  77. package/linter/rules/dataframe-access-validation.d.ts +1 -1
  78. package/linter/rules/dataframe-access-validation.js +8 -10
  79. package/linter/rules/unused-definition.js +1 -1
  80. package/package.json +1 -1
  81. package/project/context/flowr-analyzer-context.d.ts +4 -0
  82. package/project/context/flowr-analyzer-files-context.d.ts +9 -1
  83. package/project/context/flowr-analyzer-files-context.js +4 -0
  84. package/project/context/flowr-file.d.ts +2 -0
  85. package/project/context/flowr-file.js +2 -0
  86. package/project/plugins/file-plugins/{flowr-description-file.d.ts → files/flowr-description-file.d.ts} +1 -1
  87. package/project/plugins/file-plugins/files/flowr-description-file.js +75 -0
  88. package/project/plugins/file-plugins/files/flowr-news-file.d.ts +27 -0
  89. package/project/plugins/file-plugins/files/flowr-news-file.js +152 -0
  90. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +1 -1
  91. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
  92. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +23 -0
  93. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +35 -0
  94. package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +1 -1
  95. package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +1 -1
  96. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
  97. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +1 -1
  98. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +1 -1
  99. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +1 -1
  100. package/project/plugins/flowr-analyzer-plugin-defaults.js +2 -0
  101. package/project/plugins/plugin-registry.d.ts +2 -1
  102. package/project/plugins/plugin-registry.js +2 -0
  103. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +7 -1
  104. package/queries/catalog/df-shape-query/df-shape-query-executor.js +4 -2
  105. package/queries/catalog/files-query/files-query-executor.d.ts +6 -0
  106. package/queries/catalog/files-query/files-query-executor.js +49 -0
  107. package/queries/catalog/files-query/files-query-format.d.ts +36 -0
  108. package/queries/catalog/files-query/files-query-format.js +114 -0
  109. package/queries/catalog/linter-query/linter-query-format.js +1 -1
  110. package/queries/query.d.ts +10 -1
  111. package/queries/query.js +3 -1
  112. package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -1
  113. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +8 -8
  114. package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +8 -8
  115. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +0 -1
  116. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +0 -1
  117. package/statistics/features/supported/data-access/data-access.js +1 -1
  118. package/util/containers.js +1 -1
  119. package/util/files.d.ts +0 -7
  120. package/util/files.js +0 -41
  121. package/util/mermaid/ast.d.ts +3 -2
  122. package/util/mermaid/ast.js +13 -7
  123. package/util/mermaid/cfg.d.ts +3 -2
  124. package/util/mermaid/cfg.js +26 -6
  125. package/util/mermaid/dfg.d.ts +1 -7
  126. package/util/mermaid/dfg.js +7 -3
  127. package/util/mermaid/info.d.ts +17 -0
  128. package/util/mermaid/info.js +5 -0
  129. package/util/prefix.d.ts +9 -5
  130. package/util/prefix.js +14 -6
  131. package/util/r-regex.d.ts +21 -0
  132. package/util/r-regex.js +25 -0
  133. package/util/text/args.js +12 -3
  134. package/util/version.js +1 -1
  135. package/abstract-interpretation/data-frame/absint-info.d.ts +0 -109
  136. package/abstract-interpretation/data-frame/absint-info.js +0 -31
  137. package/abstract-interpretation/data-frame/absint-visitor.d.ts +0 -57
  138. package/abstract-interpretation/data-frame/absint-visitor.js +0 -176
  139. package/abstract-interpretation/data-frame/mappers/assignment-mapper.d.ts +0 -21
  140. package/abstract-interpretation/data-frame/mappers/assignment-mapper.js +0 -34
  141. package/documentation/doc-util/doc-print.d.ts +0 -5
  142. package/documentation/doc-util/doc-print.js +0 -36
  143. package/project/plugins/file-plugins/flowr-description-file.js +0 -37
  144. package/project/plugins/file-plugins/notebooks/notebook.d.ts +0 -0
  145. package/project/plugins/file-plugins/notebooks/notebook.js +0 -2
  146. /package/project/plugins/file-plugins/{notebooks → files}/flowr-jupyter-file.d.ts +0 -0
  147. /package/project/plugins/file-plugins/{notebooks → files}/flowr-jupyter-file.js +0 -0
  148. /package/project/plugins/file-plugins/{notebooks → files}/flowr-rmarkdown-file.d.ts +0 -0
  149. /package/project/plugins/file-plugins/{notebooks → files}/flowr-rmarkdown-file.js +0 -0
@@ -0,0 +1,17 @@
1
+ import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
2
+ type MarkVertex = NodeId;
3
+ type MarkEdge = `${string}->${string}`;
4
+ export type MermaidMarkdownMark = MarkVertex | MarkEdge;
5
+ export interface MermaidMarkStyle {
6
+ readonly vertex: string;
7
+ readonly edge: string;
8
+ }
9
+ export interface MermaidGraphPrinterInfo {
10
+ includeOnlyIds?: ReadonlySet<NodeId>;
11
+ mark?: ReadonlySet<MermaidMarkdownMark>;
12
+ markStyle?: MermaidMarkStyle;
13
+ prefix?: string;
14
+ simplify?: boolean;
15
+ }
16
+ export declare const MermaidDefaultMarkStyle: MermaidMarkStyle;
17
+ export {};
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MermaidDefaultMarkStyle = void 0;
4
+ exports.MermaidDefaultMarkStyle = { vertex: 'stroke:teal,stroke-width:7px,stroke-opacity:.8;', edge: 'stroke:teal,stroke-width:4.2px,stroke-opacity:.8' };
5
+ //# sourceMappingURL=info.js.map
package/util/prefix.d.ts CHANGED
@@ -1,12 +1,16 @@
1
1
  /**
2
- * given a potentially partial prefix like `hell`, this finds the matching name in the map, but only
2
+ * Given a potentially partial prefix like `hell`, this finds the matching name in the keys, but only
3
3
  * if it is unique!
4
+ * Please note, that `...` is considered special here, anything *afteR* `...` will not be matched by prefix but only by exact name,
5
+ * following R's pmatch semantics.
4
6
  * @example
5
7
  * ```typescript
6
- * findByPrefixIfUnique('hell', { 'hello', 'bar' }) // => 'hello'
7
- * findByPrefixIfUnique('hell', { 'hello', 'hell' }) // => 'hell' (full match)
8
- * findByPrefixIfUnique('h', { 'hello', 'hell' }) // => undefined (not unique)
9
- * findByPrefixIfUnique('', { 'hello', 'hell' }) // => undefined (empty prefix)
8
+ * findByPrefixIfUnique('hello', [ 'hello', 'bar' ]) // => 'hello'
9
+ * findByPrefixIfUnique('hell', [ 'hello', 'bar' ]) // => 'hello'
10
+ * findByPrefixIfUnique('hell', [ 'hello', 'hell' ]) // => 'hell' (full/exact match)
11
+ * findByPrefixIfUnique('hell', [ 'bar', '...', 'hello' ]) // => undefined (not matched due to being after `...`)
12
+ * findByPrefixIfUnique('h', [ 'hello', 'hell' ]) // => undefined (not unique)
13
+ * findByPrefixIfUnique('', [ 'hello', 'hell' ]) // => undefined (empty prefix)
10
14
  * ```
11
15
  */
12
16
  export declare function findByPrefixIfUnique(prefix: string, keys: readonly string[] | MapIterator<string>): string | undefined;
package/util/prefix.js CHANGED
@@ -2,14 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.findByPrefixIfUnique = findByPrefixIfUnique;
4
4
  /**
5
- * given a potentially partial prefix like `hell`, this finds the matching name in the map, but only
5
+ * Given a potentially partial prefix like `hell`, this finds the matching name in the keys, but only
6
6
  * if it is unique!
7
+ * Please note, that `...` is considered special here, anything *afteR* `...` will not be matched by prefix but only by exact name,
8
+ * following R's pmatch semantics.
7
9
  * @example
8
10
  * ```typescript
9
- * findByPrefixIfUnique('hell', { 'hello', 'bar' }) // => 'hello'
10
- * findByPrefixIfUnique('hell', { 'hello', 'hell' }) // => 'hell' (full match)
11
- * findByPrefixIfUnique('h', { 'hello', 'hell' }) // => undefined (not unique)
12
- * findByPrefixIfUnique('', { 'hello', 'hell' }) // => undefined (empty prefix)
11
+ * findByPrefixIfUnique('hello', [ 'hello', 'bar' ]) // => 'hello'
12
+ * findByPrefixIfUnique('hell', [ 'hello', 'bar' ]) // => 'hello'
13
+ * findByPrefixIfUnique('hell', [ 'hello', 'hell' ]) // => 'hell' (full/exact match)
14
+ * findByPrefixIfUnique('hell', [ 'bar', '...', 'hello' ]) // => undefined (not matched due to being after `...`)
15
+ * findByPrefixIfUnique('h', [ 'hello', 'hell' ]) // => undefined (not unique)
16
+ * findByPrefixIfUnique('', [ 'hello', 'hell' ]) // => undefined (empty prefix)
13
17
  * ```
14
18
  */
15
19
  function findByPrefixIfUnique(prefix, keys) {
@@ -17,11 +21,15 @@ function findByPrefixIfUnique(prefix, keys) {
17
21
  return undefined;
18
22
  }
19
23
  let found = undefined;
24
+ let matchPartial = true;
20
25
  for (const key of keys) {
21
26
  if (key === prefix) {
22
27
  return key;
23
28
  }
24
- if (key.startsWith(prefix)) {
29
+ if (key === '...') {
30
+ matchPartial = false;
31
+ }
32
+ else if (matchPartial && key.startsWith(prefix)) {
25
33
  if (found) {
26
34
  return undefined;
27
35
  }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Represents R's `.standard_regexps` definitions.
3
+ * @see https://github.com/r-devel/r-svn/blob/44474af03ae77fd3b9a340279fa10cb698d106c3/src/library/base/R/utils.R#L52-L53
4
+ */
5
+ export declare const RStandardRegexp: {
6
+ /** `[[:alpha:]][[:alnum:].]*[[:alnum:]]` */
7
+ ValidPackageName: RegExp;
8
+ /** `([[:digit:]]+[.-]){1,}[[:digit:]]+` */
9
+ ValidPackageVersion: RegExp;
10
+ /** `[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+` */
11
+ ValidRSystemVersion: RegExp;
12
+ /** `([[:digit:]]+[.-])*[[:digit:]]+` */
13
+ ValidNumericVersion: RegExp;
14
+ };
15
+ /**
16
+ * Based on the C-definition:
17
+ * ```txt
18
+ * !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
19
+ * ```
20
+ */
21
+ export declare const RPunctuationChars = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RPunctuationChars = exports.RStandardRegexp = void 0;
4
+ /**
5
+ * Represents R's `.standard_regexps` definitions.
6
+ * @see https://github.com/r-devel/r-svn/blob/44474af03ae77fd3b9a340279fa10cb698d106c3/src/library/base/R/utils.R#L52-L53
7
+ */
8
+ exports.RStandardRegexp = {
9
+ /** `[[:alpha:]][[:alnum:].]*[[:alnum:]]` */
10
+ ValidPackageName: (/[A-Za-z][A-Za-z0-9._]*[A-Za-z0-9]/),
11
+ /** `([[:digit:]]+[.-]){1,}[[:digit:]]+` */
12
+ ValidPackageVersion: (/([0-9]+[.-])+[0-9]+/),
13
+ /** `[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+` */
14
+ ValidRSystemVersion: (/[0-9]+\.[0-9]+\.[0-9]+/),
15
+ /** `([[:digit:]]+[.-])*[[:digit:]]+` */
16
+ ValidNumericVersion: /([0-9]+[.-])*[0-9]+/
17
+ };
18
+ /**
19
+ * Based on the C-definition:
20
+ * ```txt
21
+ * !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
22
+ * ```
23
+ */
24
+ exports.RPunctuationChars = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~';
25
+ //# sourceMappingURL=r-regex.js.map
package/util/text/args.js CHANGED
@@ -55,10 +55,19 @@ function splitAtEscapeSensitive(inputString, escapeQuote = true, split = ' ') {
55
55
  current = '';
56
56
  }
57
57
  else if (c === '"' || c === "'") {
58
- inQuotes = !inQuotes;
59
- if (!escapeQuote) {
60
- current += c;
58
+ if (!inQuotes) {
59
+ inQuotes = c;
60
+ if (escapeQuote) {
61
+ continue;
62
+ }
61
63
  }
64
+ else if (inQuotes === c) {
65
+ inQuotes = false;
66
+ if (escapeQuote) {
67
+ continue;
68
+ }
69
+ }
70
+ current += c;
62
71
  }
63
72
  else if (c === '\\' && escapeQuote) {
64
73
  escaped = true;
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.7.0';
9
+ const version = '2.7.2';
10
10
  /**
11
11
  * Retrieves the current flowR version as a new {@link SemVer} object.
12
12
  */
@@ -1,109 +0,0 @@
1
- import type { RNode } from '../../r-bridge/lang-4.x/ast/model/model';
2
- import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
3
- import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
4
- import type { DataFrameStateDomain } from './dataframe-domain';
5
- import type { ConstraintType, DataFrameOperationArgs, DataFrameOperationName, DataFrameOperationOptions } from './semantics';
6
- /**
7
- * An abstract data frame operation without additional options.
8
- * - `operation` contains the type of the abstract operation (see {@link DataFrameOperationName})
9
- * - `operand` contains the ID of the data frame operand of the operation (may be `undefined`)
10
- * - `...args` contains the arguments of the abstract operation (see {@link DataFrameOperationArgs})
11
- */
12
- export type DataFrameOperationType<OperationName extends DataFrameOperationName = DataFrameOperationName> = {
13
- [Name in OperationName]: {
14
- operation: Name;
15
- operand: NodeId | undefined;
16
- } & DataFrameOperationArgs<Name>;
17
- }[OperationName];
18
- /**
19
- * An abstract data frame operation.
20
- * - `operation` contains the type of the abstract operation (see {@link DataFrameOperationName})
21
- * - `operand` contains the ID of the data frame operand of the operation (may be `undefined`)
22
- * - `type` optionally contains the constraint type to overwrite the default type of the operation (see {@link ConstraintType})
23
- * - `options` optionally contains additional options for the abstract operation (see {@link DataFrameOperationOptions})
24
- * - `...args` contains the arguments of the abstract operation (see {@link DataFrameOperationArgs})
25
- */
26
- export type DataFrameOperation<OperationName extends DataFrameOperationName = DataFrameOperationName> = {
27
- [Name in OperationName]: {
28
- operation: Name;
29
- operand: NodeId | undefined;
30
- type?: ConstraintType;
31
- options?: DataFrameOperationOptions<Name>;
32
- } & DataFrameOperationArgs<Name>;
33
- }[OperationName];
34
- /**
35
- * Represents the base data frame information stored in the abstract interpretation info of an AST node.
36
- * - `type` optionally defines the type of the extra information stored in the data frame info
37
- * - `domain` contains the abstract data frame shape state of the node
38
- * This may not be present if the data frame shape inference has not been executed yet or the program contains no data frames
39
- */
40
- interface DataFrameInfoBase {
41
- type?: string;
42
- domain?: DataFrameStateDomain;
43
- }
44
- /** Enum to mark nodes during the data frame shape inference */
45
- export declare enum DataFrameInfoMarker {
46
- /** Marks the target symbol of assignments as "unassigned" until the assigned expression is evaluated */
47
- Unassigned = "unassigned"
48
- }
49
- /**
50
- * Represents the data frame information for a node without extra data frame information,
51
- * i.e. for all nodes that do not represent a data frame assignment or data frame operation (this is the default).
52
- *
53
- * The `marker` can be used to mark nodes during the data frame shape inference.
54
- */
55
- interface DataFrameEmptyInfo extends DataFrameInfoBase {
56
- type?: never;
57
- marker?: DataFrameInfoMarker;
58
- }
59
- /**
60
- * Represents the data frame information for a data frame assignment with a target identifier (symbol/string) and an assigned expression.
61
- * This is used during data frame shape inference to mark assignments of data frame expressions to an identifier.
62
- *
63
- * Use {@link hasDataFrameAssignmentInfo} to check whether an AST node has attached data frame assignment information.
64
- */
65
- export interface DataFrameAssignmentInfo extends DataFrameInfoBase {
66
- type: 'assignment';
67
- identifier: NodeId;
68
- expression: NodeId;
69
- }
70
- /**
71
- * Represents the data frame information for a data frame function/operation with mapped abstract operations.
72
- * This is used during data frame shape inference to store the abstract operations a data frame function/operation is mapped to.
73
- *
74
- * The order of the abstract operations is the order in which their semantics are applied (for example, access operations are typically before other operations in the list).
75
- * Moreover, abstract operations that take the result of previous abstract operation as data frame operand must have the `operand` set to `undefined`.
76
- *
77
- * Use {@link hasDataFrameExpressionInfo} to check whether an AST node has attached data frame expression information.
78
- */
79
- export interface DataFrameExpressionInfo extends DataFrameInfoBase {
80
- type: 'expression';
81
- operations: DataFrameOperation[];
82
- }
83
- /**
84
- * Represents the data frame shape inference information stored in the abstract interpretation info of AST nodes.
85
- */
86
- export type DataFrameInfo = DataFrameEmptyInfo | DataFrameAssignmentInfo | DataFrameExpressionInfo;
87
- /**
88
- * Represents the abstract interpretation information attached to AST nodes.
89
- */
90
- export interface AbstractInterpretationInfo {
91
- dataFrame?: DataFrameInfo;
92
- }
93
- /**
94
- * Checks whether an AST node has attached data frame assignment information.
95
- */
96
- export declare function hasDataFrameAssignmentInfo<OtherInfo>(node: RNode<OtherInfo & ParentInformation & AbstractInterpretationInfo>): node is RNode<OtherInfo & ParentInformation & AbstractInterpretationInfo & {
97
- dataFrame: DataFrameAssignmentInfo;
98
- }>;
99
- /**
100
- * Checks whether an AST node has attached data frame expression information.
101
- */
102
- export declare function hasDataFrameExpressionInfo<OtherInfo>(node: RNode<OtherInfo & ParentInformation & AbstractInterpretationInfo>): node is RNode<OtherInfo & ParentInformation & AbstractInterpretationInfo & {
103
- dataFrame: DataFrameExpressionInfo;
104
- }>;
105
- /**
106
- * Checks whether an AST node has an attached data frame info marker.
107
- */
108
- export declare function hasDataFrameInfoMarker<OtherInfo>(node: RNode<OtherInfo & ParentInformation & AbstractInterpretationInfo>, marker: DataFrameInfoMarker): boolean;
109
- export {};
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DataFrameInfoMarker = void 0;
4
- exports.hasDataFrameAssignmentInfo = hasDataFrameAssignmentInfo;
5
- exports.hasDataFrameExpressionInfo = hasDataFrameExpressionInfo;
6
- exports.hasDataFrameInfoMarker = hasDataFrameInfoMarker;
7
- /** Enum to mark nodes during the data frame shape inference */
8
- var DataFrameInfoMarker;
9
- (function (DataFrameInfoMarker) {
10
- /** Marks the target symbol of assignments as "unassigned" until the assigned expression is evaluated */
11
- DataFrameInfoMarker["Unassigned"] = "unassigned";
12
- })(DataFrameInfoMarker || (exports.DataFrameInfoMarker = DataFrameInfoMarker = {}));
13
- /**
14
- * Checks whether an AST node has attached data frame assignment information.
15
- */
16
- function hasDataFrameAssignmentInfo(node) {
17
- return node.info.dataFrame?.type === 'assignment';
18
- }
19
- /**
20
- * Checks whether an AST node has attached data frame expression information.
21
- */
22
- function hasDataFrameExpressionInfo(node) {
23
- return node.info.dataFrame?.type === 'expression';
24
- }
25
- /**
26
- * Checks whether an AST node has an attached data frame info marker.
27
- */
28
- function hasDataFrameInfoMarker(node, marker) {
29
- return node.info.dataFrame?.type === undefined && node.info.dataFrame?.marker === marker;
30
- }
31
- //# sourceMappingURL=absint-info.js.map
@@ -1,57 +0,0 @@
1
- import { type CfgBasicBlockVertex, type CfgSimpleVertex, type ControlFlowInformation } from '../../control-flow/control-flow-graph';
2
- import { SemanticCfgGuidedVisitor, type SemanticCfgGuidedVisitorConfiguration } from '../../control-flow/semantic-cfg-guided-visitor';
3
- import type { DataflowGraph } from '../../dataflow/graph/graph';
4
- import type { DataflowGraphVertexFunctionCall, DataflowGraphVertexVariableDefinition } from '../../dataflow/graph/vertex';
5
- import type { NoInfo } from '../../r-bridge/lang-4.x/ast/model/model';
6
- import type { NormalizedAst } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
7
- import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
8
- import { type AbstractInterpretationInfo } from './absint-info';
9
- export type DataFrameShapeInferenceVisitorConfiguration<OtherInfo = NoInfo, ControlFlow extends ControlFlowInformation = ControlFlowInformation, Ast extends NormalizedAst<OtherInfo & AbstractInterpretationInfo> = NormalizedAst<OtherInfo & AbstractInterpretationInfo>, Dfg extends DataflowGraph = DataflowGraph> = Omit<SemanticCfgGuidedVisitorConfiguration<OtherInfo & AbstractInterpretationInfo, ControlFlow, Ast, Dfg>, 'defaultVisitingOrder' | 'defaultVisitingType'>;
10
- /**
11
- * The control flow graph visitor to infer the shape of data frames using abstract interpretation
12
- */
13
- export declare class DataFrameShapeInferenceVisitor<OtherInfo = NoInfo, ControlFlow extends ControlFlowInformation = ControlFlowInformation, Ast extends NormalizedAst<OtherInfo & AbstractInterpretationInfo> = NormalizedAst<OtherInfo & AbstractInterpretationInfo>, Dfg extends DataflowGraph = DataflowGraph, Config extends DataFrameShapeInferenceVisitorConfiguration<OtherInfo, ControlFlow, Ast, Dfg> = DataFrameShapeInferenceVisitorConfiguration<OtherInfo, ControlFlow, Ast, Dfg>> extends SemanticCfgGuidedVisitor<OtherInfo & AbstractInterpretationInfo, ControlFlow, Ast, Dfg, Config & {
14
- defaultVisitingOrder: 'forward';
15
- defaultVisitingType: 'exit';
16
- }> {
17
- /**
18
- * The old domain of an AST node before processing the node retrieved from the attached {@link AbstractInterpretationInfo}.
19
- * This is used to check whether the state has changed and successors should be visited again, and is also required for widening.
20
- */
21
- private oldDomain;
22
- /**
23
- * The new domain of an AST node during and after processing the node.
24
- * This information is stored in the {@link AbstractInterpretationInfo} afterward.
25
- */
26
- private newDomain;
27
- constructor(config: Config);
28
- protected visitNode(nodeId: NodeId): boolean;
29
- protected visitDataflowNode(vertex: Exclude<CfgSimpleVertex, CfgBasicBlockVertex>): void;
30
- protected onVariableDefinition({ vertex }: {
31
- vertex: DataflowGraphVertexVariableDefinition;
32
- }): void;
33
- protected onAssignmentCall({ call, target, source }: {
34
- call: DataflowGraphVertexFunctionCall;
35
- target?: NodeId;
36
- source?: NodeId;
37
- }): void;
38
- protected onAccessCall({ call }: {
39
- call: DataflowGraphVertexFunctionCall;
40
- }): void;
41
- protected onDefaultFunctionCall({ call }: {
42
- call: DataflowGraphVertexFunctionCall;
43
- }): void;
44
- protected onReplacementCall({ call, source, target }: {
45
- call: DataflowGraphVertexFunctionCall;
46
- source: NodeId | undefined;
47
- target: NodeId | undefined;
48
- }): void;
49
- private applyDataFrameAssignment;
50
- private applyDataFrameExpression;
51
- /** We only process vertices of leaf nodes and exit vertices (no entry nodes of complex nodes) */
52
- private shouldSkipVertex;
53
- /** Get all AST nodes for the predecessor vertices that are leaf nodes and exit vertices */
54
- private getPredecessorNodes;
55
- private shouldWiden;
56
- private clearUnassignedInfo;
57
- }
@@ -1,176 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DataFrameShapeInferenceVisitor = void 0;
4
- const control_flow_graph_1 = require("../../control-flow/control-flow-graph");
5
- const semantic_cfg_guided_visitor_1 = require("../../control-flow/semantic-cfg-guided-visitor");
6
- const assert_1 = require("../../util/assert");
7
- const absint_info_1 = require("./absint-info");
8
- const dataframe_domain_1 = require("./dataframe-domain");
9
- const access_mapper_1 = require("./mappers/access-mapper");
10
- const assignment_mapper_1 = require("./mappers/assignment-mapper");
11
- const function_mapper_1 = require("./mappers/function-mapper");
12
- const replacement_mapper_1 = require("./mappers/replacement-mapper");
13
- const semantics_1 = require("./semantics");
14
- const shape_inference_1 = require("./shape-inference");
15
- /**
16
- * The control flow graph visitor to infer the shape of data frames using abstract interpretation
17
- */
18
- class DataFrameShapeInferenceVisitor extends semantic_cfg_guided_visitor_1.SemanticCfgGuidedVisitor {
19
- /**
20
- * The old domain of an AST node before processing the node retrieved from the attached {@link AbstractInterpretationInfo}.
21
- * This is used to check whether the state has changed and successors should be visited again, and is also required for widening.
22
- */
23
- oldDomain = dataframe_domain_1.DataFrameStateDomain.bottom();
24
- /**
25
- * The new domain of an AST node during and after processing the node.
26
- * This information is stored in the {@link AbstractInterpretationInfo} afterward.
27
- */
28
- newDomain = dataframe_domain_1.DataFrameStateDomain.bottom();
29
- constructor(config) {
30
- super({ ...config, defaultVisitingOrder: 'forward', defaultVisitingType: 'exit' });
31
- }
32
- visitNode(nodeId) {
33
- const vertex = this.getCfgVertex(nodeId);
34
- // skip vertices representing entries of complex nodes
35
- if (vertex === undefined || this.shouldSkipVertex(vertex)) {
36
- return true;
37
- }
38
- const predecessors = this.getPredecessorNodes(vertex.id);
39
- const predecessorDomains = predecessors.map(node => node.info.dataFrame?.domain).filter(assert_1.isNotUndefined);
40
- this.newDomain = dataframe_domain_1.DataFrameStateDomain.bottom().joinAll(predecessorDomains);
41
- this.onVisitNode(nodeId);
42
- const visitedCount = this.visited.get(vertex.id) ?? 0;
43
- this.visited.set(vertex.id, visitedCount + 1);
44
- // only continue visiting if the node has not been visited before or the data frame value of the node changed
45
- return visitedCount === 0 || !this.oldDomain.equals(this.newDomain);
46
- }
47
- visitDataflowNode(vertex) {
48
- const node = this.getNormalizedAst((0, control_flow_graph_1.getVertexRootId)(vertex));
49
- if (node === undefined) {
50
- return;
51
- }
52
- this.oldDomain = node.info.dataFrame?.domain ?? dataframe_domain_1.DataFrameStateDomain.bottom();
53
- super.visitDataflowNode(vertex);
54
- if (this.config.dfg.unknownSideEffects.has((0, control_flow_graph_1.getVertexRootId)(vertex))) {
55
- this.newDomain = this.newDomain.bottom();
56
- }
57
- if (this.shouldWiden(vertex)) {
58
- this.newDomain = this.oldDomain.widen(this.newDomain);
59
- }
60
- node.info.dataFrame ??= {};
61
- node.info.dataFrame.domain = this.newDomain;
62
- }
63
- onVariableDefinition({ vertex }) {
64
- const node = this.getNormalizedAst(vertex.id);
65
- if (node !== undefined) {
66
- // mark variable definitions as "unassigned", as the evaluation of the assigned expression is delayed until processing the assignment
67
- node.info.dataFrame ??= { marker: absint_info_1.DataFrameInfoMarker.Unassigned };
68
- }
69
- }
70
- onAssignmentCall({ call, target, source }) {
71
- const node = this.getNormalizedAst(call.id);
72
- const targetNode = this.getNormalizedAst(target);
73
- const sourceNode = this.getNormalizedAst(source);
74
- if (node !== undefined && (0, assignment_mapper_1.isAssignmentTarget)(targetNode) && sourceNode !== undefined) {
75
- node.info.dataFrame = (0, assignment_mapper_1.mapDataFrameVariableAssignment)(targetNode, sourceNode, this.config.dfg, this.config.ctx);
76
- this.applyDataFrameAssignment(node);
77
- this.clearUnassignedInfo(targetNode);
78
- }
79
- }
80
- onAccessCall({ call }) {
81
- const node = this.getNormalizedAst(call.id);
82
- if (node !== undefined) {
83
- node.info.dataFrame = (0, access_mapper_1.mapDataFrameAccess)(node, this.config.dfg, this.config.ctx);
84
- this.applyDataFrameExpression(node);
85
- }
86
- }
87
- onDefaultFunctionCall({ call }) {
88
- const node = this.getNormalizedAst(call.id);
89
- if (node !== undefined) {
90
- node.info.dataFrame = (0, function_mapper_1.mapDataFrameFunctionCall)(node, this.config.dfg, this.config.ctx);
91
- this.applyDataFrameExpression(node);
92
- }
93
- }
94
- onReplacementCall({ call, source, target }) {
95
- const node = this.getNormalizedAst(call.id);
96
- const targetNode = this.getNormalizedAst(target);
97
- const sourceNode = this.getNormalizedAst(source);
98
- if (node !== undefined && targetNode !== undefined && sourceNode !== undefined) {
99
- node.info.dataFrame = (0, replacement_mapper_1.mapDataFrameReplacementFunction)(node, sourceNode, this.config.dfg, this.config.ctx);
100
- this.applyDataFrameExpression(node);
101
- this.clearUnassignedInfo(targetNode);
102
- }
103
- }
104
- applyDataFrameAssignment(node) {
105
- if (!(0, absint_info_1.hasDataFrameAssignmentInfo)(node)) {
106
- return;
107
- }
108
- const value = (0, shape_inference_1.resolveIdToDataFrameShape)(node.info.dataFrame.expression, this.config.dfg, this.newDomain);
109
- if (value !== undefined) {
110
- this.newDomain.set(node.info.dataFrame.identifier, value);
111
- const identifier = this.getNormalizedAst(node.info.dataFrame.identifier);
112
- if (identifier !== undefined) {
113
- identifier.info.dataFrame ??= {};
114
- identifier.info.dataFrame.domain = this.newDomain.create(this.newDomain.value);
115
- }
116
- }
117
- }
118
- applyDataFrameExpression(node) {
119
- if (!(0, absint_info_1.hasDataFrameExpressionInfo)(node)) {
120
- return;
121
- }
122
- const maxColNames = this.config.ctx.config.abstractInterpretation.dataFrame.maxColNames;
123
- let value = dataframe_domain_1.DataFrameDomain.top(maxColNames);
124
- for (const { operation, operand, type, options, ...args } of node.info.dataFrame.operations) {
125
- const operandValue = operand !== undefined ? (0, shape_inference_1.resolveIdToDataFrameShape)(operand, this.config.dfg, this.newDomain) : value;
126
- value = (0, semantics_1.applyDataFrameSemantics)(operation, operandValue ?? dataframe_domain_1.DataFrameDomain.top(maxColNames), args, options);
127
- const constraintType = type ?? (0, semantics_1.getConstraintType)(operation);
128
- if (operand !== undefined && constraintType === semantics_1.ConstraintType.OperandModification) {
129
- this.newDomain.set(operand, value);
130
- for (const origin of (0, shape_inference_1.getVariableOrigins)(operand, this.config.dfg)) {
131
- this.newDomain.set(origin.info.id, value);
132
- }
133
- }
134
- else if (constraintType === semantics_1.ConstraintType.ResultPostcondition) {
135
- this.newDomain.set(node.info.id, value);
136
- }
137
- }
138
- }
139
- /** We only process vertices of leaf nodes and exit vertices (no entry nodes of complex nodes) */
140
- shouldSkipVertex(vertex) {
141
- return (0, control_flow_graph_1.isMarkerVertex)(vertex) ? vertex.type !== control_flow_graph_1.CfgVertexType.EndMarker : vertex.end !== undefined;
142
- }
143
- /** Get all AST nodes for the predecessor vertices that are leaf nodes and exit vertices */
144
- getPredecessorNodes(vertexId) {
145
- return this.config.controlFlow.graph.outgoingEdges(vertexId)?.keys() // outgoing dependency edges are incoming CFG edges
146
- .map(id => this.getCfgVertex(id))
147
- .flatMap(vertex => {
148
- if (vertex === undefined) {
149
- return [];
150
- }
151
- else if (this.shouldSkipVertex(vertex)) {
152
- return this.getPredecessorNodes(vertex.id);
153
- }
154
- else {
155
- return [this.getNormalizedAst((0, control_flow_graph_1.getVertexRootId)(vertex))];
156
- }
157
- })
158
- .filter(assert_1.isNotUndefined)
159
- .toArray() ?? [];
160
- }
161
- shouldWiden(vertex) {
162
- return (this.visited.get(vertex.id) ?? 0) >= this.config.ctx.config.abstractInterpretation.dataFrame.wideningThreshold;
163
- }
164
- clearUnassignedInfo(node) {
165
- if ((0, absint_info_1.hasDataFrameInfoMarker)(node, absint_info_1.DataFrameInfoMarker.Unassigned)) {
166
- if (node.info.dataFrame?.domain !== undefined) {
167
- node.info.dataFrame = { domain: node.info.dataFrame.domain };
168
- }
169
- else {
170
- delete node.info.dataFrame;
171
- }
172
- }
173
- }
174
- }
175
- exports.DataFrameShapeInferenceVisitor = DataFrameShapeInferenceVisitor;
176
- //# sourceMappingURL=absint-visitor.js.map
@@ -1,21 +0,0 @@
1
- import type { DataflowGraph } from '../../../dataflow/graph/graph';
2
- import type { RNode } from '../../../r-bridge/lang-4.x/ast/model/model';
3
- import type { RString } from '../../../r-bridge/lang-4.x/ast/model/nodes/r-string';
4
- import type { RSymbol } from '../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
5
- import type { ParentInformation } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
6
- import type { DataFrameAssignmentInfo } from '../absint-info';
7
- import type { ReadOnlyFlowrAnalyzerContext } from '../../../project/context/flowr-analyzer-context';
8
- /**
9
- * Maps a concrete data frame assignment to data frame assignment info containing the ids of the identifier and assigned expression.
10
- * We currently do not support function assignments dealing with data frames.
11
- * @param identifier - The R node of the variable identifier
12
- * @param expression - The R node of the assigned expression
13
- * @param dfg - The data flow graph for resolving the arguments
14
- * @param ctx - The analysis context
15
- * @returns Data frame assignment info containing the IDs of the identifier and expression, or `undefined` if the node does not represent a data frame assignment
16
- */
17
- export declare function mapDataFrameVariableAssignment(identifier: RSymbol<ParentInformation> | RString<ParentInformation>, expression: RNode<ParentInformation>, dfg: DataflowGraph, ctx: ReadOnlyFlowrAnalyzerContext): DataFrameAssignmentInfo | undefined;
18
- /**
19
- * Checks whether a R node represents an assignment target, i.e. is a `RSymbol` or `RString`.
20
- */
21
- export declare function isAssignmentTarget(node: RNode<ParentInformation> | undefined): node is RSymbol<ParentInformation> | RString<ParentInformation>;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapDataFrameVariableAssignment = mapDataFrameVariableAssignment;
4
- exports.isAssignmentTarget = isAssignmentTarget;
5
- const config_1 = require("../../../config");
6
- const type_1 = require("../../../r-bridge/lang-4.x/ast/model/type");
7
- const arguments_1 = require("./arguments");
8
- /**
9
- * Maps a concrete data frame assignment to data frame assignment info containing the ids of the identifier and assigned expression.
10
- * We currently do not support function assignments dealing with data frames.
11
- * @param identifier - The R node of the variable identifier
12
- * @param expression - The R node of the assigned expression
13
- * @param dfg - The data flow graph for resolving the arguments
14
- * @param ctx - The analysis context
15
- * @returns Data frame assignment info containing the IDs of the identifier and expression, or `undefined` if the node does not represent a data frame assignment
16
- */
17
- function mapDataFrameVariableAssignment(identifier, expression, dfg, ctx) {
18
- const resolveInfo = { graph: dfg, idMap: dfg.idMap, full: true, resolve: config_1.VariableResolve.Alias, ctx };
19
- if (!(0, arguments_1.isDataFrameArgument)(expression, resolveInfo)) {
20
- return;
21
- }
22
- return {
23
- type: 'assignment',
24
- identifier: identifier.info.id,
25
- expression: expression.info.id
26
- };
27
- }
28
- /**
29
- * Checks whether a R node represents an assignment target, i.e. is a `RSymbol` or `RString`.
30
- */
31
- function isAssignmentTarget(node) {
32
- return node?.type === type_1.RType.Symbol || node?.type === type_1.RType.String;
33
- }
34
- //# sourceMappingURL=assignment-mapper.js.map
@@ -1,5 +0,0 @@
1
- /**
2
- * Writes the wiki documentation to the specified output path.
3
- * Returns true if the file was updated, false if it was unchanged.
4
- */
5
- export declare function writeWikiTo(text: string, output_path: string, check_change?: boolean): boolean;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.writeWikiTo = writeWikiTo;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
- /* eslint-disable */
10
- const IgnoreRegex = /[0-9]+(\.[0-9]+)? ?ms|"timing":\s*[0-9]+(\.0-9)?,?|tmp-[A-Za-z0-9-]+/g;
11
- /* eslint-enable */
12
- /**
13
- * Checks whether the file contains a different content, but ignores timing and some other non-semantic changes.
14
- */
15
- function didFileChange(filePath, content) {
16
- if (!fs_1.default.existsSync(filePath)) {
17
- return true; // If the file does not exist, it is considered changed.
18
- }
19
- const currentContent = fs_1.default.readFileSync(filePath, 'utf-8');
20
- const cleanedCurrentContent = currentContent.replace(IgnoreRegex, '');
21
- const cleanedNewContent = content.replace(IgnoreRegex, '');
22
- return cleanedCurrentContent !== cleanedNewContent;
23
- }
24
- /**
25
- * Writes the wiki documentation to the specified output path.
26
- * Returns true if the file was updated, false if it was unchanged.
27
- */
28
- function writeWikiTo(text, output_path, check_change = true) {
29
- if (!check_change || didFileChange(output_path, text)) {
30
- fs_1.default.mkdirSync(path_1.default.dirname(output_path), { recursive: true });
31
- fs_1.default.writeFileSync(output_path, text, 'utf-8');
32
- return true;
33
- }
34
- return false;
35
- }
36
- //# sourceMappingURL=doc-print.js.map