@eagleoutice/flowr 2.7.0 → 2.7.3

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 (168) hide show
  1. package/README.md +14 -14
  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 +15 -9
  9. package/abstract-interpretation/data-frame/mappers/arguments.js +27 -4
  10. package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +17 -17
  11. package/abstract-interpretation/data-frame/mappers/function-mapper.js +55 -67
  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/resolve-args.d.ts +1 -1
  15. package/abstract-interpretation/data-frame/resolve-args.js +1 -1
  16. package/abstract-interpretation/data-frame/semantics.js +5 -6
  17. package/abstract-interpretation/data-frame/shape-inference.d.ts +52 -28
  18. package/abstract-interpretation/data-frame/shape-inference.js +67 -90
  19. package/abstract-interpretation/domains/bounded-set-domain.d.ts +2 -2
  20. package/abstract-interpretation/domains/interval-domain.d.ts +2 -2
  21. package/abstract-interpretation/domains/set-range-domain.d.ts +10 -4
  22. package/abstract-interpretation/domains/set-range-domain.js +7 -1
  23. package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +2 -2
  24. package/abstract-interpretation/domains/singleton-domain.d.ts +2 -2
  25. package/benchmark/slicer.js +13 -14
  26. package/cli/common/options.d.ts +431 -8
  27. package/cli/common/options.js +1 -1
  28. package/cli/common/scripts-info.d.ts +431 -7
  29. package/cli/flowr-main-options.d.ts +102 -2
  30. package/cli/flowr.d.ts +102 -2
  31. package/cli/repl/commands/repl-commands.d.ts +25 -0
  32. package/cli/repl/commands/repl-query.js +17 -5
  33. package/cli/wiki.d.ts +13 -0
  34. package/cli/wiki.js +7 -2
  35. package/config.d.ts +4 -4
  36. package/config.js +1 -1
  37. package/control-flow/basic-cfg-guided-visitor.js +7 -8
  38. package/control-flow/control-flow-graph.d.ts +1 -1
  39. package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
  40. package/control-flow/semantic-cfg-guided-visitor.js +1 -1
  41. package/dataflow/eval/resolve/alias-tracking.js +1 -1
  42. package/dataflow/internal/linker.d.ts +2 -0
  43. package/dataflow/internal/linker.js +10 -12
  44. package/documentation/doc-capabilities.d.ts +1 -1
  45. package/documentation/doc-readme.d.ts +1 -1
  46. package/documentation/doc-util/doc-cfg.js +1 -1
  47. package/documentation/doc-util/doc-cli-option.d.ts +6 -6
  48. package/documentation/doc-util/doc-cli-option.js +3 -3
  49. package/documentation/doc-util/doc-dfg.d.ts +1 -1
  50. package/documentation/doc-util/doc-files.d.ts +3 -0
  51. package/documentation/doc-util/doc-files.js +4 -1
  52. package/documentation/doc-util/doc-normalized-ast.js +2 -2
  53. package/documentation/issue-linting-rule.d.ts +1 -1
  54. package/documentation/wiki-analyzer.d.ts +1 -1
  55. package/documentation/wiki-cfg.d.ts +1 -1
  56. package/documentation/wiki-core.d.ts +1 -1
  57. package/documentation/wiki-dataflow-graph.d.ts +1 -1
  58. package/documentation/wiki-dataflow-graph.js +6 -6
  59. package/documentation/wiki-engine.d.ts +1 -1
  60. package/documentation/wiki-engine.js +9 -10
  61. package/documentation/wiki-faq.d.ts +1 -1
  62. package/documentation/wiki-interface.d.ts +1 -1
  63. package/documentation/wiki-interface.js +12 -13
  64. package/documentation/wiki-linter.d.ts +1 -1
  65. package/documentation/wiki-linting-and-testing.d.ts +1 -1
  66. package/documentation/wiki-mk/doc-context.d.ts +54 -1
  67. package/documentation/wiki-mk/doc-context.js +17 -0
  68. package/documentation/wiki-mk/doc-maker.d.ts +5 -5
  69. package/documentation/wiki-mk/doc-maker.js +3 -1
  70. package/documentation/wiki-normalized-ast.d.ts +1 -1
  71. package/documentation/wiki-onboarding.d.ts +1 -1
  72. package/documentation/wiki-overview.d.ts +9 -0
  73. package/documentation/wiki-overview.js +248 -0
  74. package/documentation/wiki-query.d.ts +1 -1
  75. package/documentation/wiki-query.js +17 -1
  76. package/documentation/wiki-search.d.ts +1 -1
  77. package/documentation/wiki-setup.d.ts +9 -0
  78. package/documentation/wiki-setup.js +122 -0
  79. package/linter/rules/dataframe-access-validation.d.ts +1 -1
  80. package/linter/rules/dataframe-access-validation.js +8 -10
  81. package/linter/rules/unused-definition.js +1 -1
  82. package/package.json +1 -1
  83. package/project/context/flowr-analyzer-context.d.ts +4 -0
  84. package/project/context/flowr-analyzer-context.js +3 -1
  85. package/project/context/flowr-analyzer-dependencies-context.d.ts +3 -2
  86. package/project/context/flowr-analyzer-dependencies-context.js +4 -2
  87. package/project/context/flowr-analyzer-files-context.d.ts +9 -1
  88. package/project/context/flowr-analyzer-files-context.js +4 -0
  89. package/project/context/flowr-analyzer-functions-context.d.ts +29 -0
  90. package/project/context/flowr-analyzer-functions-context.js +68 -0
  91. package/project/context/flowr-file.d.ts +2 -0
  92. package/project/context/flowr-file.js +2 -0
  93. package/project/plugins/file-plugins/{flowr-description-file.d.ts → files/flowr-description-file.d.ts} +1 -1
  94. package/project/plugins/file-plugins/files/flowr-description-file.js +75 -0
  95. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +32 -0
  96. package/project/plugins/file-plugins/files/flowr-namespace-file.js +102 -0
  97. package/project/plugins/file-plugins/files/flowr-news-file.d.ts +27 -0
  98. package/project/plugins/file-plugins/files/flowr-news-file.js +152 -0
  99. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +1 -1
  100. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
  101. package/project/plugins/file-plugins/flowr-analyzer-namespace-file-plugin.d.ts +22 -0
  102. package/project/plugins/file-plugins/flowr-analyzer-namespace-file-plugin.js +34 -0
  103. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +23 -0
  104. package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +35 -0
  105. package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +1 -1
  106. package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +1 -1
  107. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
  108. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +1 -1
  109. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +1 -1
  110. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +1 -1
  111. package/project/plugins/flowr-analyzer-plugin-defaults.js +4 -0
  112. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +5 -1
  113. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.d.ts +10 -0
  114. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +56 -0
  115. package/project/plugins/package-version-plugins/package.d.ts +15 -2
  116. package/project/plugins/package-version-plugins/package.js +33 -5
  117. package/project/plugins/plugin-registry.d.ts +3 -1
  118. package/project/plugins/plugin-registry.js +4 -0
  119. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +7 -1
  120. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -1
  121. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +2 -0
  122. package/queries/catalog/dependencies-query/dependencies-query-format.js +2 -1
  123. package/queries/catalog/df-shape-query/df-shape-query-executor.js +4 -2
  124. package/queries/catalog/files-query/files-query-executor.d.ts +6 -0
  125. package/queries/catalog/files-query/files-query-executor.js +49 -0
  126. package/queries/catalog/files-query/files-query-format.d.ts +36 -0
  127. package/queries/catalog/files-query/files-query-format.js +114 -0
  128. package/queries/catalog/linter-query/linter-query-format.js +1 -1
  129. package/queries/query.d.ts +10 -1
  130. package/queries/query.js +3 -1
  131. package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -1
  132. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +8 -8
  133. package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +8 -8
  134. package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +0 -1
  135. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +0 -1
  136. package/statistics/features/supported/data-access/data-access.js +1 -1
  137. package/util/containers.js +1 -1
  138. package/util/files.d.ts +0 -7
  139. package/util/files.js +0 -41
  140. package/util/mermaid/ast.d.ts +3 -2
  141. package/util/mermaid/ast.js +13 -7
  142. package/util/mermaid/cfg.d.ts +3 -2
  143. package/util/mermaid/cfg.js +26 -6
  144. package/util/mermaid/dfg.d.ts +1 -7
  145. package/util/mermaid/dfg.js +7 -3
  146. package/util/mermaid/info.d.ts +17 -0
  147. package/util/mermaid/info.js +5 -0
  148. package/util/prefix.d.ts +9 -5
  149. package/util/prefix.js +14 -6
  150. package/util/r-regex.d.ts +21 -0
  151. package/util/r-regex.js +25 -0
  152. package/util/text/args.js +12 -3
  153. package/util/version.js +1 -1
  154. package/abstract-interpretation/data-frame/absint-info.d.ts +0 -109
  155. package/abstract-interpretation/data-frame/absint-info.js +0 -31
  156. package/abstract-interpretation/data-frame/absint-visitor.d.ts +0 -57
  157. package/abstract-interpretation/data-frame/absint-visitor.js +0 -176
  158. package/abstract-interpretation/data-frame/mappers/assignment-mapper.d.ts +0 -21
  159. package/abstract-interpretation/data-frame/mappers/assignment-mapper.js +0 -34
  160. package/documentation/doc-util/doc-print.d.ts +0 -5
  161. package/documentation/doc-util/doc-print.js +0 -36
  162. package/project/plugins/file-plugins/flowr-description-file.js +0 -37
  163. package/project/plugins/file-plugins/notebooks/notebook.d.ts +0 -0
  164. package/project/plugins/file-plugins/notebooks/notebook.js +0 -2
  165. /package/project/plugins/file-plugins/{notebooks → files}/flowr-jupyter-file.d.ts +0 -0
  166. /package/project/plugins/file-plugins/{notebooks → files}/flowr-jupyter-file.js +0 -0
  167. /package/project/plugins/file-plugins/{notebooks → files}/flowr-rmarkdown-file.d.ts +0 -0
  168. /package/project/plugins/file-plugins/{notebooks → files}/flowr-rmarkdown-file.js +0 -0
@@ -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
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FlowrDescriptionFile = void 0;
4
- const flowr_file_1 = require("../../context/flowr-file");
5
- const files_1 = require("../../../util/files");
6
- /**
7
- * This decorates a text file and provides access to its content as a DCF (Debian Control File)-like structure.
8
- */
9
- class FlowrDescriptionFile extends flowr_file_1.FlowrFile {
10
- wrapped;
11
- /**
12
- * Prefer the static {@link FlowrDescriptionFile.from} method to create instances of this class as it will not re-create if already a description file
13
- * and handle role assignments.
14
- */
15
- constructor(file) {
16
- super(file.path(), file.role);
17
- this.wrapped = file;
18
- }
19
- /**
20
- * Loads and parses the content of the wrapped file as a DCF structure.
21
- * @see {@link parseDCF} for details on the parsing logic.
22
- */
23
- loadContent() {
24
- return (0, files_1.parseDCF)(this.wrapped);
25
- }
26
- /**
27
- * Description file lifter, this does not re-create if already a description file
28
- */
29
- static from(file, role) {
30
- if (role) {
31
- file.assignRole(role);
32
- }
33
- return file instanceof FlowrDescriptionFile ? file : new FlowrDescriptionFile(file);
34
- }
35
- }
36
- exports.FlowrDescriptionFile = FlowrDescriptionFile;
37
- //# sourceMappingURL=flowr-description-file.js.map
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=notebook.js.map