@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
package/cli/flowr.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import commandLineUsage from 'command-line-usage';
2
1
  export declare const toolName = "flowr";
3
2
  export interface FlowrCliOptions {
4
3
  'config-file': string;
@@ -32,6 +31,107 @@ export declare const optionHelp: ({
32
31
  optionList?: undefined;
33
32
  } | {
34
33
  header: string;
35
- optionList: commandLineUsage.OptionDefinition[];
34
+ optionList: [{
35
+ readonly name: "config-file";
36
+ readonly type: StringConstructor;
37
+ readonly description: "The name of the configuration file to use";
38
+ readonly multiple: false;
39
+ }, {
40
+ readonly name: "config-json";
41
+ readonly type: StringConstructor;
42
+ readonly description: "The flowR configuration to use, as a JSON string";
43
+ readonly multiple: false;
44
+ }, {
45
+ readonly name: "execute";
46
+ readonly alias: "e";
47
+ readonly type: StringConstructor;
48
+ readonly description: "Execute the given command and exit. Use a semicolon \";\" to separate multiple commands.";
49
+ readonly typeLabel: "{underline command}";
50
+ readonly multiple: false;
51
+ }, {
52
+ readonly name: "help";
53
+ readonly alias: "h";
54
+ readonly type: BooleanConstructor;
55
+ readonly description: "Print this usage guide (or the guide of the corresponding script)";
56
+ }, {
57
+ readonly name: "no-ansi";
58
+ readonly type: BooleanConstructor;
59
+ readonly description: "Disable ansi-escape-sequences in the output. Useful, if you want to redirect the output to a file.";
60
+ }, {
61
+ readonly name: "port";
62
+ readonly type: NumberConstructor;
63
+ readonly description: "The port to listen on, if --server is given.";
64
+ readonly defaultValue: 1042;
65
+ readonly typeLabel: "{underline port}";
66
+ }, {
67
+ readonly name: "r-path";
68
+ readonly type: StringConstructor;
69
+ readonly description: "The path to the R executable to use. Defaults to your PATH. This option is being phased out in favor of the engine configuration option \"engine.r-shell.r-path\", which should be used instead.";
70
+ readonly multiple: false;
71
+ }, {
72
+ readonly name: "r-session-access";
73
+ readonly type: BooleanConstructor;
74
+ readonly description: "Allow to access the underlying R session when using flowR (security warning: this allows the execution of arbitrary R code!)";
75
+ }, {
76
+ readonly name: "script";
77
+ readonly alias: "s";
78
+ readonly type: StringConstructor;
79
+ readonly description: `The sub-script to run (${string})`;
80
+ readonly multiple: false;
81
+ readonly defaultOption: true;
82
+ readonly typeLabel: "{underline files}";
83
+ readonly defaultValue: undefined;
84
+ }, {
85
+ readonly name: "server";
86
+ readonly type: BooleanConstructor;
87
+ readonly description: "Do not drop into a repl, but instead start a server on the given port (default: 1042) and listen for messages.";
88
+ }, {
89
+ readonly name: "verbose";
90
+ readonly alias: "v";
91
+ readonly type: BooleanConstructor;
92
+ readonly description: "Run with verbose logging (will be passed to the corresponding script)";
93
+ }, {
94
+ readonly name: "version";
95
+ readonly alias: "V";
96
+ readonly type: BooleanConstructor;
97
+ readonly description: "Provide information about the version of flowR as well as its underlying R system and exit.";
98
+ }, {
99
+ readonly name: "ws";
100
+ readonly type: BooleanConstructor;
101
+ readonly description: "If the server flag is set, use websocket for messaging";
102
+ }, {
103
+ readonly name: "engine.r-shell.disabled";
104
+ readonly type: BooleanConstructor;
105
+ readonly description: "Disable the R shell engine";
106
+ }, {
107
+ readonly name: "engine.r-shell.r-path";
108
+ readonly type: StringConstructor;
109
+ readonly description: "The path to the R executable to use. Defaults to your PATH.";
110
+ readonly multiple: false;
111
+ }, {
112
+ readonly name: "engine.tree-sitter.disabled";
113
+ readonly type: BooleanConstructor;
114
+ readonly description: "Disable the tree-sitter engine";
115
+ }, {
116
+ readonly name: "engine.tree-sitter.wasm-path";
117
+ readonly type: StringConstructor;
118
+ readonly description: "The path to the tree-sitter-r WASM binary to use. Defaults to the one shipped with flowR.";
119
+ readonly multiple: false;
120
+ }, {
121
+ readonly name: "engine.tree-sitter.tree-sitter-wasm-path";
122
+ readonly type: StringConstructor;
123
+ readonly description: "The path to the tree-sitter WASM binary to use. Defaults to the path specified by the tree-sitter package.";
124
+ readonly multiple: false;
125
+ }, {
126
+ readonly name: "engine.tree-sitter.lax";
127
+ readonly type: BooleanConstructor;
128
+ readonly description: "Use the lax parser for parsing R code (allowing for syntax errors).";
129
+ readonly multiple: false;
130
+ }, {
131
+ readonly name: "default-engine";
132
+ readonly type: StringConstructor;
133
+ readonly description: "The default engine to use for interacting with R code. If this is undefined, an arbitrary engine from the specified list will be used.";
134
+ readonly multiple: false;
135
+ }];
36
136
  content?: undefined;
37
137
  })[];
@@ -1,5 +1,29 @@
1
1
  import type { ReplCodeCommand, ReplCommand } from './repl-main';
2
+ import { scripts } from '../../common/scripts-info';
2
3
  export declare const helpCommand: ReplCommand;
4
+ /**
5
+ * All commands that should be available in the REPL.
6
+ */
7
+ declare const _commands: {
8
+ readonly help: ReplCommand;
9
+ readonly quit: ReplCommand;
10
+ readonly version: ReplCommand;
11
+ readonly execute: ReplCommand;
12
+ readonly parse: ReplCodeCommand;
13
+ readonly normalize: ReplCodeCommand;
14
+ readonly 'normalize*': ReplCodeCommand;
15
+ readonly dataflow: ReplCodeCommand;
16
+ readonly 'dataflow*': ReplCodeCommand;
17
+ readonly dataflowsimple: ReplCodeCommand;
18
+ readonly 'dataflowsimple*': ReplCodeCommand;
19
+ readonly controlflow: ReplCodeCommand;
20
+ readonly 'controlflow*': ReplCodeCommand;
21
+ readonly controlflowbb: ReplCodeCommand;
22
+ readonly 'controlflowbb*': ReplCodeCommand;
23
+ readonly query: ReplCodeCommand;
24
+ readonly 'query*': ReplCodeCommand;
25
+ };
26
+ export type ReplCommandNames = keyof typeof _commands | keyof typeof scripts;
3
27
  /**
4
28
  * Retrieve all REPL commands (including those generated from master scripts)
5
29
  */
@@ -26,3 +50,4 @@ export declare function longestCommandName(): number;
26
50
  * @see {@link longestCommandName}
27
51
  */
28
52
  export declare function padCmd<T>(string: T): string;
53
+ export {};
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.queryStarCommand = exports.queryCommand = void 0;
4
- const retriever_1 = require("../../../r-bridge/retriever");
5
- const args_1 = require("../../../util/text/args");
6
4
  const ansi_1 = require("../../../util/text/ansi");
7
5
  const schema_1 = require("../../../util/schema");
8
6
  const query_1 = require("../../../queries/query");
9
- const json_1 = require("../../../util/json");
7
+ const retriever_1 = require("../../../r-bridge/retriever");
10
8
  const query_print_1 = require("../../../queries/query-print");
9
+ const json_1 = require("../../../util/json");
10
+ const args_1 = require("../../../util/text/args");
11
11
  function printHelp(output) {
12
12
  output.stderr(`Format: ${(0, ansi_1.italic)(':query "<query>" <code>', output.formatter)}`);
13
13
  output.stdout('The query is an array of query objects to represent multiple queries. Each query object may have the following properties:');
@@ -45,8 +45,20 @@ async function processQueryArgs(output, analyzer, remainingArgs) {
45
45
  }
46
46
  const validationResult = (0, query_1.QueriesSchema)().validate(parsedQuery);
47
47
  if (validationResult.error) {
48
- output.stderr(`Invalid query: ${validationResult.error.message}`);
49
- printHelp(output);
48
+ output.stderr(`Invalid query: "${output.formatter.format(JSON.stringify(parsedQuery), { style: 3 /* FontStyles.Italic */, color: 3 /* Colors.Yellow */, effect: ansi_1.ColorEffect.Foreground })}"`);
49
+ for (const line of validationResult.error.details) {
50
+ const value = line.context?.value ? JSON.stringify(line.context.value) : undefined;
51
+ output.stderr(` - ${line.message} ${value ? '(' + (0, ansi_1.italic)(value, output.formatter) + ')' : ''}`);
52
+ const ctx = line.context;
53
+ for (const detail of ctx?.details?.slice(0, ctx.details.length - 1) ?? []) {
54
+ if ('context' in detail && 'message' in detail.context) {
55
+ const lines = detail.context.message.split('. ');
56
+ for (const l of lines) {
57
+ output.stderr(` - ${l.trim()}`);
58
+ }
59
+ }
60
+ }
61
+ }
50
62
  return;
51
63
  }
52
64
  }
package/cli/wiki.d.ts CHANGED
@@ -1,3 +1,16 @@
1
+ import { WikiFaq } from '../documentation/wiki-faq';
2
+ import { DocCapabilities, WikiCore, WikiDataflowGraph, WikiEngine, WikiInterface, WikiLintingAndTesting, WikiNormalizedAst, WikiQuery, WikiSearch } from '../documentation';
3
+ import { WikiCfg } from '../documentation/wiki-cfg';
4
+ import { WikiOnboarding } from '../documentation/wiki-onboarding';
5
+ import { WikiAnalyzer } from '../documentation/wiki-analyzer';
6
+ import { IssueLintingRule } from '../documentation/issue-linting-rule';
7
+ import { DocReadme } from '../documentation/doc-readme';
8
+ import { WikiLinter } from '../documentation/wiki-linter';
9
+ import { WikiSetup } from '../documentation/wiki-setup';
10
+ import { WikiOverview } from '../documentation/wiki-overview';
11
+ export declare const AllWikiDocuments: [WikiFaq, WikiSearch, WikiCfg, WikiQuery, WikiOnboarding, WikiAnalyzer, WikiEngine, WikiNormalizedAst, WikiCore, WikiSetup, WikiOverview, WikiInterface, WikiDataflowGraph, WikiLintingAndTesting, WikiLinter, IssueLintingRule, DocReadme, DocCapabilities];
12
+ export type ValidWikiDocumentTargets = ReturnType<typeof AllWikiDocuments[number]['getTarget']>;
13
+ export type ValidWikiDocumentTargetsNoSuffix = ValidWikiDocumentTargets extends `${infer Name}.${string}` ? Name : never;
1
14
  /**
2
15
  * Updates and optionally re-creates all flowR wikis.
3
16
  */
package/cli/wiki.js CHANGED
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AllWikiDocuments = void 0;
6
7
  exports.makeAllWikis = makeAllWikis;
7
8
  const doc_context_1 = require("../documentation/wiki-mk/doc-context");
8
9
  const shell_1 = require("../r-bridge/shell");
@@ -22,7 +23,9 @@ const issue_linting_rule_1 = require("../documentation/issue-linting-rule");
22
23
  const doc_readme_1 = require("../documentation/doc-readme");
23
24
  const wiki_linter_1 = require("../documentation/wiki-linter");
24
25
  const os_1 = __importDefault(require("os"));
25
- const Documents = [
26
+ const wiki_setup_1 = require("../documentation/wiki-setup");
27
+ const wiki_overview_1 = require("../documentation/wiki-overview");
28
+ exports.AllWikiDocuments = [
26
29
  new wiki_faq_1.WikiFaq(),
27
30
  new documentation_1.WikiSearch(),
28
31
  new wiki_cfg_1.WikiCfg(),
@@ -32,6 +35,8 @@ const Documents = [
32
35
  new documentation_1.WikiEngine(),
33
36
  new documentation_1.WikiNormalizedAst(),
34
37
  new documentation_1.WikiCore(),
38
+ new wiki_setup_1.WikiSetup(),
39
+ new wiki_overview_1.WikiOverview(),
35
40
  new documentation_1.WikiInterface(),
36
41
  new documentation_1.WikiDataflowGraph(),
37
42
  new documentation_1.WikiLintingAndTesting(),
@@ -82,7 +87,7 @@ async function makeAllWikis(force, filter) {
82
87
  console.log(`Setup for wiki generation took ${(new Date().getTime() - setupStart.getTime())}ms`);
83
88
  const changedWikis = new Set();
84
89
  try {
85
- const sortedDocs = sortByLeastRecentChanged(Documents);
90
+ const sortedDocs = sortByLeastRecentChanged(exports.AllWikiDocuments);
86
91
  console.log(`Generating ${sortedDocs.length} wikis/docs, sorted by most recently updated...`);
87
92
  for (const doc of sortedDocs) {
88
93
  const type = doc.getTarget().toLowerCase().includes('wiki') ? 'Wiki' : 'Doc';
package/config.d.ts CHANGED
@@ -152,6 +152,10 @@ export interface FlowrConfigOptions extends MergeableRecord {
152
152
  * Configuration options for abstract interpretation
153
153
  */
154
154
  readonly abstractInterpretation: {
155
+ /**
156
+ * The threshold for the number of visitations of a node at which widening should be performed to ensure the termination of the fixpoint iteration
157
+ */
158
+ readonly wideningThreshold: number;
155
159
  /**
156
160
  * The configuration of the shape inference for data frames
157
161
  */
@@ -160,10 +164,6 @@ export interface FlowrConfigOptions extends MergeableRecord {
160
164
  * The maximum number of columns names to infer for data frames before over-approximating the column names to top
161
165
  */
162
166
  readonly maxColNames: number;
163
- /**
164
- * The threshold for the number of visitations of a node at which widening should be performed to ensure the termination of the fixpoint iteration
165
- */
166
- readonly wideningThreshold: number;
167
167
  /**
168
168
  * Configuration options for reading data frame shapes from loaded external data files, such as CSV files
169
169
  */
package/config.js CHANGED
@@ -86,9 +86,9 @@ exports.defaultConfigOptions = {
86
86
  }
87
87
  },
88
88
  abstractInterpretation: {
89
+ wideningThreshold: 4,
89
90
  dataFrame: {
90
91
  maxColNames: 50,
91
- wideningThreshold: 4,
92
92
  readLoadedData: {
93
93
  readExternalFiles: true,
94
94
  maxReadLines: 1e6
@@ -30,19 +30,18 @@ class BasicCfgGuidedVisitor {
30
30
  return true;
31
31
  }
32
32
  startVisitor(start) {
33
- const g = this.config.controlFlow.graph;
34
- const n = this.config.defaultVisitingOrder === 'forward' ?
35
- (n) => g.ingoingEdges(n) :
36
- (n) => g.outgoingEdges(n);
33
+ const graph = this.config.controlFlow.graph;
34
+ const getNext = this.config.defaultVisitingOrder === 'forward' ?
35
+ (node) => graph.ingoingEdges(node)?.keys().toArray().toReversed() :
36
+ (node) => graph.outgoingEdges(node)?.keys().toArray();
37
37
  const stack = [...start];
38
38
  while (stack.length > 0) {
39
- const current = stack.shift();
39
+ const current = stack.pop();
40
40
  if (!this.visitNode(current)) {
41
41
  continue;
42
42
  }
43
- const outgoing = n(current) ?? [];
44
- for (const [to] of outgoing) {
45
- stack.unshift(to);
43
+ for (const next of getNext(current) ?? []) {
44
+ stack.push(next);
46
45
  }
47
46
  }
48
47
  }
@@ -103,7 +103,7 @@ export interface ReadOnlyControlFlowGraph {
103
103
  readonly rootIds: () => ReadonlySet<NodeId>;
104
104
  /**
105
105
  * Provide a view of all vertices in the graph.
106
- * @param includeBasicBlockElements - if true, the elements of basic block elements are included in the result, otherwise this will only the basic blocks themselves
106
+ * @param includeBasicBlockElements - if true, the elements of basic block elements are included in the result, otherwise only the basic blocks themselves are included
107
107
  * @see {@link ReadOnlyControlFlowGraph#rootVertexIds|rootVertexIds()} - for a way to get the root vertices of the graph.
108
108
  * @see {@link ReadOnlyControlFlowGraph#getVertex|getVertex()} - for a way to get a specific vertex by its id.
109
109
  * @see {@link ReadOnlyControlFlowGraph#edges|edges()} - for a way to get all edges in the graph.
@@ -205,7 +205,7 @@ export declare class SemanticCfgGuidedVisitor<OtherInfo = NoInfo, ControlFlow ex
205
205
  * @protected
206
206
  */
207
207
  protected onUnnamedCall(_data: {
208
- vertex: DataflowGraphVertexFunctionCall;
208
+ call: DataflowGraphVertexFunctionCall;
209
209
  }): void;
210
210
  /**
211
211
  * This event triggers for every function call that is not handled by a specific overload,
@@ -115,7 +115,7 @@ class SemanticCfgGuidedVisitor extends dfg_cfg_guided_visitor_1.DataflowAwareCfg
115
115
  visitFunctionCall(vertex) {
116
116
  super.visitFunctionCall(vertex);
117
117
  if (vertex.origin === 'unnamed') {
118
- this.onUnnamedCall({ vertex });
118
+ this.onUnnamedCall({ call: vertex });
119
119
  }
120
120
  else {
121
121
  this.onDispatchFunctionCallOrigins(vertex, vertex.origin);
@@ -92,7 +92,7 @@ function getAliases(sourceIds, dataflow, environment) {
92
92
  definitions.add(def);
93
93
  }
94
94
  }
95
- return [...definitions];
95
+ return Array.from(definitions);
96
96
  }
97
97
  /**
98
98
  * Evaluates the value of a node in the set domain.
@@ -19,6 +19,8 @@ export declare function findNonLocalReads(graph: DataflowGraph, ignore: readonly
19
19
  export declare function produceNameSharedIdMap(references: IdentifierReference[]): NameIdMap;
20
20
  /**
21
21
  * Links the given arguments to the given parameters within the given graph.
22
+ * This follows the `pmatch` semantics of R
23
+ * @see https://cran.r-project.org/doc/manuals/R-lang.html#Argument-matching
22
24
  */
23
25
  export declare function linkArgumentsOnCall(args: FunctionArgument[], params: RParameter<ParentInformation>[], graph: DataflowGraph): void;
24
26
  /**
@@ -79,27 +79,28 @@ function produceNameSharedIdMap(references) {
79
79
  }
80
80
  /**
81
81
  * Links the given arguments to the given parameters within the given graph.
82
+ * This follows the `pmatch` semantics of R
83
+ * @see https://cran.r-project.org/doc/manuals/R-lang.html#Argument-matching
82
84
  */
83
85
  function linkArgumentsOnCall(args, params, graph) {
84
86
  const nameArgMap = new Map(args.filter(graph_1.isNamedArgument).map(a => [a.name, a]));
85
- const nameParamMap = new Map(params.filter(p => p?.name?.content !== undefined).map(p => [p.name.content, p]));
87
+ const nameParamMap = new Map(params.filter(p => p?.name?.content !== undefined)
88
+ .map(p => [p.name.content, p]));
86
89
  const specialDotParameter = params.find(p => p.special);
87
90
  // all parameters matched by name
88
91
  const matchedParameters = new Set();
89
92
  // first map names
90
- for (const [name, arg] of nameArgMap) {
93
+ for (const [name, { nodeId: argId }] of nameArgMap) {
91
94
  const pmatchName = (0, prefix_1.findByPrefixIfUnique)(name, nameParamMap.keys()) ?? name;
92
95
  const param = nameParamMap.get(pmatchName);
93
96
  if (param?.name) {
94
- logger_1.dataflowLogger.trace(`mapping named argument "${name}" to parameter "${param.name.content}"`);
95
- graph.addEdge(arg.nodeId, param.name.info.id, edge_1.EdgeType.DefinesOnCall);
96
- graph.addEdge(param.name.info.id, arg.nodeId, edge_1.EdgeType.DefinedByOnCall);
97
+ graph.addEdge(argId, param.name.info.id, edge_1.EdgeType.DefinesOnCall);
98
+ graph.addEdge(param.name.info.id, argId, edge_1.EdgeType.DefinedByOnCall);
97
99
  matchedParameters.add(name);
98
100
  }
99
101
  else if (specialDotParameter?.name) {
100
- logger_1.dataflowLogger.trace(`mapping named argument "${name}" to dot-dot-dot parameter`);
101
- graph.addEdge(arg.nodeId, specialDotParameter.name.info.id, edge_1.EdgeType.DefinesOnCall);
102
- graph.addEdge(specialDotParameter.name.info.id, arg.nodeId, edge_1.EdgeType.DefinedByOnCall);
102
+ graph.addEdge(argId, specialDotParameter.name.info.id, edge_1.EdgeType.DefinesOnCall);
103
+ graph.addEdge(specialDotParameter.name.info.id, argId, edge_1.EdgeType.DefinedByOnCall);
103
104
  }
104
105
  }
105
106
  const remainingParameter = params.filter(p => !p?.name || !matchedParameters.has(p.name.content));
@@ -107,12 +108,10 @@ function linkArgumentsOnCall(args, params, graph) {
107
108
  for (let i = 0; i < remainingArguments.length; i++) {
108
109
  const arg = remainingArguments[i];
109
110
  if (arg === r_function_call_1.EmptyArgument) {
110
- logger_1.dataflowLogger.trace(`skipping value argument for ${i}`);
111
111
  continue;
112
112
  }
113
113
  if (remainingParameter.length <= i) {
114
114
  if (specialDotParameter !== undefined) {
115
- logger_1.dataflowLogger.trace(`mapping unnamed argument ${i} (id: ${arg.nodeId}) to dot-dot-dot parameter`);
116
115
  graph.addEdge(arg.nodeId, specialDotParameter.name.info.id, edge_1.EdgeType.DefinesOnCall);
117
116
  graph.addEdge(specialDotParameter.name.info.id, arg.nodeId, edge_1.EdgeType.DefinedByOnCall);
118
117
  }
@@ -133,14 +132,13 @@ function linkFunctionCallArguments(targetId, idMap, functionCallName, functionRo
133
132
  // we get them by just choosing the rhs of the definition
134
133
  const linkedFunction = idMap.get(targetId);
135
134
  if (linkedFunction === undefined) {
136
- logger_1.dataflowLogger.trace(`no function definition found for ${functionCallName} (${functionRootId})`);
135
+ logger_1.dataflowLogger.trace(`no fdef found for ${functionCallName} (${functionRootId})`);
137
136
  return;
138
137
  }
139
138
  if (linkedFunction.type !== type_1.RType.FunctionDefinition) {
140
139
  logger_1.dataflowLogger.trace(`function call definition base ${functionCallName} does not lead to a function definition (${functionRootId}) but got ${linkedFunction.type}`);
141
140
  return;
142
141
  }
143
- (0, log_1.expensiveTrace)(logger_1.dataflowLogger, () => `linking arguments for ${functionCallName} (${functionRootId}) to ${JSON.stringify(linkedFunction.location)}`);
144
142
  linkArgumentsOnCall(callArgs, linkedFunction.parameters, finalGraph);
145
143
  }
146
144
  /**
@@ -3,7 +3,7 @@ import { DocMaker } from './wiki-mk/doc-maker';
3
3
  /**
4
4
  * https://github.com/flowr-analysis/flowr/wiki/Capabilities
5
5
  */
6
- export declare class DocCapabilities extends DocMaker {
6
+ export declare class DocCapabilities extends DocMaker<'wiki/Capabilities.md'> {
7
7
  constructor();
8
8
  protected text({ treeSitter }: DocMakerArgs): Promise<string>;
9
9
  }
@@ -3,7 +3,7 @@ import { DocMaker } from './wiki-mk/doc-maker';
3
3
  /**
4
4
  * https://github.com/flowr-analysis/flowr/blob/main/README.md
5
5
  */
6
- export declare class DocReadme extends DocMaker {
6
+ export declare class DocReadme extends DocMaker<'README.md'> {
7
7
  constructor();
8
8
  text({ treeSitter }: DocMakerArgs): Promise<string>;
9
9
  }
@@ -30,7 +30,7 @@ async function getCfg(parser, code, simplifications = [], useDfg = true) {
30
30
  */
31
31
  function printCfg(cfg, ast, prefix = 'flowchart BT\n', simplify = false) {
32
32
  return `
33
- ${(0, doc_code_1.codeBlock)('mermaid', (0, cfg_1.cfgToMermaid)(cfg, ast, prefix, simplify))}
33
+ ${(0, doc_code_1.codeBlock)('mermaid', (0, cfg_1.cfgToMermaid)(cfg, ast, { prefix, simplify }))}
34
34
  `;
35
35
  }
36
36
  /**
@@ -1,17 +1,17 @@
1
1
  /** Automatically provides hover over with the documentation for these! */
2
2
  import { scripts } from '../../cli/common/scripts-info';
3
3
  import { flowrMainOptionDefinitions } from '../../cli/flowr-main-options';
4
- type ScriptOptions<Type extends keyof typeof scripts | 'flowr'> = Type extends keyof typeof scripts ? typeof scripts[Type]['options'][number]['name'] : Type extends 'flowr' ? typeof flowrMainOptionDefinitions[number]['name'] : never;
4
+ import type { ReplCommandNames } from '../../cli/repl/commands/repl-commands';
5
+ export type ScriptOptions<Type extends keyof typeof scripts | 'flowr'> = Type extends keyof typeof scripts ? typeof scripts[Type]['options'][number]['name'] : Type extends 'flowr' ? typeof flowrMainOptionDefinitions[number]['name'] : never;
5
6
  /**
6
- *
7
+ * Produce the documentation string for a CLI long option
7
8
  */
8
9
  export declare function getCliLongOptionOf<ScriptName extends keyof typeof scripts | 'flowr', OptionName extends ScriptOptions<ScriptName>>(scriptName: ScriptName, optionName: OptionName, withAlias?: boolean, quote?: boolean): string;
9
10
  /**
10
- *
11
+ * Produce the documentation string for multiple CLI long options
11
12
  */
12
13
  export declare function multipleCliOptions<ScriptName extends keyof typeof scripts | 'flowr', OptionName extends ScriptOptions<ScriptName>>(scriptName: ScriptName, ...options: OptionName[]): string;
13
14
  /**
14
- *
15
+ * Produce the documentation string for a REPL command
15
16
  */
16
- export declare function getReplCommand(commandName: string, quote?: boolean, showStar?: boolean): string;
17
- export {};
17
+ export declare function getReplCommand(commandName: ReplCommandNames | string, quote?: boolean, showStar?: boolean): string;
@@ -11,7 +11,7 @@ const flowr_main_options_1 = require("../../cli/flowr-main-options");
11
11
  const repl_commands_1 = require("../../cli/repl/commands/repl-commands");
12
12
  const doc_escape_1 = require("./doc-escape");
13
13
  /**
14
- *
14
+ * Produce the documentation string for a CLI long option
15
15
  */
16
16
  function getCliLongOptionOf(scriptName, optionName, withAlias = false, quote = true) {
17
17
  const script = scriptName === 'flowr' ? flowr_main_options_1.flowrMainOptionDefinitions : scripts_info_1.scripts[scriptName].options;
@@ -26,13 +26,13 @@ function getCliLongOptionOf(scriptName, optionName, withAlias = false, quote = t
26
26
  return (0, html_hover_over_1.textWithTooltip)(`${char}-${ligatureBreaker}-${optionName}${char}`, 'Description (Command Line Argument): ' + description) + alias;
27
27
  }
28
28
  /**
29
- *
29
+ * Produce the documentation string for multiple CLI long options
30
30
  */
31
31
  function multipleCliOptions(scriptName, ...options) {
32
32
  return options.map(o => getCliLongOptionOf(scriptName, o, false, true)).join(' ');
33
33
  }
34
34
  /**
35
- *
35
+ * Produce the documentation string for a REPL command
36
36
  */
37
37
  function getReplCommand(commandName, quote = true, showStar = false) {
38
38
  const availableNames = (0, repl_commands_1.getReplCommands)();
@@ -1,8 +1,8 @@
1
1
  import type { DataflowGraph, UnknownSideEffect } from '../../dataflow/graph/graph';
2
- import { type MermaidMarkdownMark } from '../../util/mermaid/dfg';
3
2
  import type { DEFAULT_DATAFLOW_PIPELINE } from '../../core/steps/pipeline/default-pipelines';
4
3
  import type { PipelineOutput } from '../../core/steps/pipeline/pipeline';
5
4
  import type { KnownParser } from '../../r-bridge/parser';
5
+ import type { MermaidMarkdownMark } from '../../util/mermaid/info';
6
6
  /**
7
7
  * Visualizes the dataflow graph as a mermaid graph inside a markdown code block.
8
8
  * Please use this only for documentation purposes, for programmatic usage use {@link graphToMermaid} directly.
@@ -3,11 +3,14 @@ export declare const FlowrGithubBaseRef = "https://github.com/flowr-analysis";
3
3
  export declare const FlowrSiteBaseRef = "https://flowr-analysis.github.io/flowr";
4
4
  export declare const RemoteFlowrFilePathBaseRef = "https://github.com/flowr-analysis/flowr/tree/main/";
5
5
  export declare const FlowrWikiBaseRef = "https://github.com/flowr-analysis/flowr/wiki";
6
+ export declare const FlowrGithubRef: string;
6
7
  export declare const FlowrNpmRef = "https://www.npmjs.com/package/@eagleoutice/flowr";
7
8
  export declare const FlowrDockerRef = "https://hub.docker.com/r/eagleoutice/flowr";
8
9
  export declare const FlowrCodecovRef = "https://app.codecov.io/gh/flowr-analysis/flowr";
9
10
  export declare const FlowrVsCode = "https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr";
10
11
  export declare const FlowrPositron = "https://open-vsx.org/extension/code-inspect/vscode-flowr";
12
+ export declare const FlowrRStudioAddin = "https://github.com/flowr-analysis/rstudio-addin-flowr";
13
+ export declare const FlowrRAdapter = "https://github.com/flowr-analysis/flowr-r-adapter";
11
14
  /**
12
15
  * Returns a markdown link to the given file path relative to the project root.
13
16
  */
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FlowrPositron = exports.FlowrVsCode = exports.FlowrCodecovRef = exports.FlowrDockerRef = exports.FlowrNpmRef = exports.FlowrWikiBaseRef = exports.RemoteFlowrFilePathBaseRef = exports.FlowrSiteBaseRef = exports.FlowrGithubBaseRef = exports.FlowrGithubGroupName = void 0;
6
+ exports.FlowrRAdapter = exports.FlowrRStudioAddin = exports.FlowrPositron = exports.FlowrVsCode = exports.FlowrCodecovRef = exports.FlowrDockerRef = exports.FlowrNpmRef = exports.FlowrGithubRef = exports.FlowrWikiBaseRef = exports.RemoteFlowrFilePathBaseRef = exports.FlowrSiteBaseRef = exports.FlowrGithubBaseRef = exports.FlowrGithubGroupName = void 0;
7
7
  exports.getFilePathMd = getFilePathMd;
8
8
  exports.getFileContentFromRoot = getFileContentFromRoot;
9
9
  exports.linkFlowRSourceFile = linkFlowRSourceFile;
@@ -13,11 +13,14 @@ exports.FlowrGithubBaseRef = `https://github.com/${exports.FlowrGithubGroupName}
13
13
  exports.FlowrSiteBaseRef = `https://${exports.FlowrGithubGroupName}.github.io/flowr`;
14
14
  exports.RemoteFlowrFilePathBaseRef = `${exports.FlowrGithubBaseRef}/flowr/tree/main/`;
15
15
  exports.FlowrWikiBaseRef = `${exports.FlowrGithubBaseRef}/flowr/wiki`;
16
+ exports.FlowrGithubRef = exports.FlowrGithubBaseRef + '/flowr';
16
17
  exports.FlowrNpmRef = 'https://www.npmjs.com/package/@eagleoutice/flowr';
17
18
  exports.FlowrDockerRef = 'https://hub.docker.com/r/eagleoutice/flowr';
18
19
  exports.FlowrCodecovRef = `https://app.codecov.io/gh/${exports.FlowrGithubGroupName}/flowr`;
19
20
  exports.FlowrVsCode = 'https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr';
20
21
  exports.FlowrPositron = 'https://open-vsx.org/extension/code-inspect/vscode-flowr';
22
+ exports.FlowrRStudioAddin = `${exports.FlowrGithubBaseRef}/rstudio-addin-flowr`;
23
+ exports.FlowrRAdapter = `${exports.FlowrGithubBaseRef}/flowr-r-adapter`;
21
24
  /**
22
25
  * Returns a markdown link to the given file path relative to the project root.
23
26
  */
@@ -19,7 +19,7 @@ const flowr_analyzer_context_1 = require("../../project/context/flowr-analyzer-c
19
19
  function printNormalizedAst(ast, prefix = 'flowchart TD\n') {
20
20
  return `
21
21
  \`\`\`mermaid
22
- ${(0, ast_1.normalizedAstToMermaid)(ast, prefix)}
22
+ ${(0, ast_1.normalizedAstToMermaid)(ast, { prefix })}
23
23
  \`\`\`
24
24
  `;
25
25
  }
@@ -50,7 +50,7 @@ ${code}
50
50
  <summary style="color:gray">Mermaid Code</summary>
51
51
 
52
52
  \`\`\`
53
- ${(0, ast_1.normalizedAstToMermaid)(result.normalize.ast, prefix)}
53
+ ${(0, ast_1.normalizedAstToMermaid)(result.normalize.ast, { prefix })}
54
54
  \`\`\`
55
55
 
56
56
  </details>
@@ -3,7 +3,7 @@ import { DocMaker } from './wiki-mk/doc-maker';
3
3
  /**
4
4
  * https://github.com/flowr-analysis/flowr/blob/main/.github/ISSUE_TEMPLATE/linting-rule.yaml
5
5
  */
6
- export declare class IssueLintingRule extends DocMaker {
6
+ export declare class IssueLintingRule extends DocMaker<'.github/ISSUE_TEMPLATE/linting-rule.yaml'> {
7
7
  constructor();
8
8
  text({ ctx }: DocMakerArgs): string;
9
9
  }
@@ -3,7 +3,7 @@ import { DocMaker } from './wiki-mk/doc-maker';
3
3
  /**
4
4
  * https://github.com/flowr-analysis/flowr/wiki/Analyzer
5
5
  */
6
- export declare class WikiAnalyzer extends DocMaker {
6
+ export declare class WikiAnalyzer extends DocMaker<'wiki/Analyzer.md'> {
7
7
  constructor();
8
8
  text({ ctx }: DocMakerArgs): string;
9
9
  }
@@ -3,7 +3,7 @@ import { DocMaker } from './wiki-mk/doc-maker';
3
3
  /**
4
4
  * https://github.com/flowr-analysis/flowr/wiki/Control-Flow-Graph
5
5
  */
6
- export declare class WikiCfg extends DocMaker {
6
+ export declare class WikiCfg extends DocMaker<'wiki/Control Flow Graph.md'> {
7
7
  constructor();
8
8
  text({ ctx, shell }: DocMakerArgs): Promise<string>;
9
9
  }
@@ -8,7 +8,7 @@ export declare function inspectContextExample(analyzer: FlowrAnalyzer): void;
8
8
  /**
9
9
  * https://github.com/flowr-analysis/flowr/wiki/Core
10
10
  */
11
- export declare class WikiCore extends DocMaker {
11
+ export declare class WikiCore extends DocMaker<'wiki/Core.md'> {
12
12
  constructor();
13
13
  text({ shell, treeSitter, ctx }: DocMakerArgs): Promise<string>;
14
14
  }
@@ -3,7 +3,7 @@ import { DocMaker } from './wiki-mk/doc-maker';
3
3
  /**
4
4
  * https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph
5
5
  */
6
- export declare class WikiDataflowGraph extends DocMaker {
6
+ export declare class WikiDataflowGraph extends DocMaker<'wiki/Dataflow Graph.md'> {
7
7
  constructor();
8
8
  protected text({ ctx, treeSitter }: DocMakerArgs): Promise<string>;
9
9
  }