@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,248 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WikiOverview = void 0;
4
+ const doc_maker_1 = require("./wiki-mk/doc-maker");
5
+ const doc_files_1 = require("./doc-util/doc-files");
6
+ const shell_1 = require("../r-bridge/shell");
7
+ const graph_1 = require("../dataflow/graph/graph");
8
+ const flowr_analyzer_1 = require("../project/flowr-analyzer");
9
+ /**
10
+ * https://github.com/flowr-analysis/flowr/wiki/Overview
11
+ */
12
+ class WikiOverview extends doc_maker_1.DocMaker {
13
+ constructor() {
14
+ super('wiki/Overview.md', module.filename, 'modules');
15
+ }
16
+ text({ ctx }) {
17
+ return `
18
+ First of all, if you have never used _flowR_ before,
19
+ please refer to the ${ctx.linkPage('wiki/Setup')} wiki page first,
20
+ for instructions on how to install _flowR_.
21
+
22
+ <!-- TOC -->
23
+ - [_flowR_'s Modules](#flowrs-modules)
24
+ - [Using _flowR_ from the outside](#using-flowr-from-the-outside)
25
+ - [The Read-Eval-Print Loop (REPL)](#the-read-eval-print-loop-repl)
26
+ - [The Server](#the-server)
27
+ - [Calling the Scripts Directly](#calling-the-scripts-directly)
28
+ - [Generate Static Slices](#generate-static-slices)
29
+ - [Benchmark the Slicer](#benchmark-the-slicer)
30
+ - [Summarizing the Benchmark Results](#summarizing-the-benchmark-results)
31
+ - [Generate Usage Statistics of R Code](#generate-usage-statistics-of-r-code)
32
+ <!-- TOC -->
33
+
34
+ ## _flowR_'s Modules
35
+
36
+ [![flowRview](https://raw.githubusercontent.com/wiki/flowr-analysis/flowr/img/flowr-overview.jpg)](${doc_files_1.FlowrGithubBaseRef}/flowr/wiki)
37
+
38
+ Primarily, _flowR_ provides a dataflow analysis framework for the [*R*](https://www.r-project.org/) programming language.
39
+ Its subcomponents (like the custom ${ctx.link(shell_1.RShell)}) or the internals of the static ${ctx.link(graph_1.DataflowGraph)})
40
+ are not important if you simply wish to use _flowR_.
41
+ If you wish to use _flowR_, check out one of its extensions (e.g., the [VS Code extension](${doc_files_1.FlowrVsCode})),
42
+ the [REPL and server interfaces](#using-_flowr_-from-the-outside) or its coding API with the
43
+ ${ctx.link(flowr_analyzer_1.FlowrAnalyzer)}.
44
+
45
+ The benchmark module is only of interest if you want to benchmark/measure the runtime performance and reduction of the slicer.
46
+ It is available with the [\`benchmark\`](#benchmark-the-slicer) script.
47
+
48
+ The statistics module is mostly independent of the slicer and can be used to analyze R files regarding their use of function definitions, assignments, and more. It is used to identify common patterns in R code and is available with the [\`statistics\`](#generate-usage-statistics-of-r-code) script.
49
+
50
+ The [core](https://github.com/flowr-analysis/flowr/tree/main/src/core) module contains _flowR_'s read-eval-print loop (REPL) and
51
+ _flowR_'s server. Furthermore, it contains the root definitions of how _flowR_ slices (see the ${ctx.linkPage('wiki/Interface')} wiki page for more information).
52
+
53
+ The [utility](https://github.com/flowr-analysis/flowr/tree/main/src/util) module is of no further interest for the usage of _flowR_
54
+
55
+ The following sections explain how to use these features.
56
+
57
+ ## Using _flowR_ from the outside
58
+
59
+ _flowR_ itself has two main ways to operate:
60
+
61
+ - as a [**server**](#the-server) which processes analysis and slicing requests (${ctx.cliOption('flowr', 'server')} option)
62
+ - as a [**read-eval-print loop** (REPL)](#the-read-eval-print-loop-repl) that can be accessed directly from the command line (default option)
63
+
64
+ Besides these two ways, there is a [Visual Studio Code extension](${doc_files_1.FlowrVsCode}) that allows you to use _flowR_ directly from within the editor (it is available on [open-vsx](${doc_files_1.FlowrPositron}) as well).
65
+ Similarly, we offer an [Addin for RStudio](${doc_files_1.FlowrRStudioAddin}), as well as an [R package](${doc_files_1.FlowrRAdapter}).
66
+
67
+ 🐳️ If you use the docker-version, simply starting the docker container in interactive mode drops you right into the REPL (\`docker run -it --rm eagleoutice/flowr:latest\`), while launching with the ${ctx.cliOption('flowr', 'server')} argument starts the server (\`docker run -it --rm eagleoutice/flowr:latest --server\`).\\
68
+ ⚒️ If you compile the _flowR_ sources yourself, you can access _flowR_ by the main script \`npm run flowr\` or in the development mode \`npm run main-dev\`.
69
+
70
+ Independent of your way of launching *flowr*, we will write simply \`flowr\` for either (🐳️)&nbsp;\`docker run -it --rm eagleoutice/flowr:latest\` or (⚒️)&nbsp;\`npm run flowr\`.
71
+ See the ${ctx.linkPage('wiki/Setup')} wiki page for more information on how to get _flowR_ running.
72
+
73
+ ### The Read-Eval-Print Loop (REPL)
74
+
75
+ Once you launched _flowR_, you should see a small&nbsp;\`R>\` prompt. Use \`:help\` to receive instructions on how to use the REPL and what features are available (most prominently, you can access all [scripts](#calling-the-scripts-directly) simply by adding a colon before them).
76
+ In general, all commands start with a colon (\`:\`), everything else is interpreted as a&nbsp;R expression which is directly evaluated by the underlying R shell
77
+ (however, due to security concerns, you need to start _flowR_ with ${ctx.cliOption('flowr', 'r-session-access')} and use the \`r-shell\` ${ctx.linkPage('wiki/Engines', 'engine')} to allow this).
78
+ See the ${ctx.linkPage('wiki/Interface')} wiki page for more information on usage and the available commands.
79
+ The following GIF showcases a simple example session:
80
+
81
+ ![Example of a simple REPL session](gif/repl-demo-opt.gif)
82
+
83
+ <!--
84
+ # Use https://github.com/charmbracelet/vhs
85
+ Output repl-demo-opt.gif
86
+
87
+ Set FontSize 30
88
+ Set Width 1600
89
+ Set Height 850
90
+ Set WindowBar Colorful
91
+ Set CursorBlink false
92
+ Set PlaybackSpeed 3.0
93
+ Set TypingSpeed 0.15
94
+
95
+ Type "docker run -it --rm eagleoutice/flowr"
96
+ Sleep 200ms
97
+ Enter
98
+ Sleep 4000ms
99
+
100
+ Type ":slicer -c '11@prod' demo.R --diff"
101
+ Sleep 400ms
102
+ Enter
103
+ Sleep 500ms
104
+ Type ":quit"
105
+ Sleep 400ms
106
+ Enter
107
+ Sleep 20000ms
108
+ -->
109
+
110
+ ### The Server
111
+
112
+ Instead of the REPL, you can start _flowR_ in "([TCP](https://de.wikipedia.org/wiki/Transmission_Control_Protocol)) server-mode" using \`flowr --server\` (write \`flowr --help\` to find out more). Together with the server option, you can configure the port with ${ctx.cliOption('flowr', 'port')}.
113
+ The supported requests are documented alongside the internal documentation, see the ${ctx.linkPage('wiki/Interface')} wiki page for more information.
114
+
115
+ <details>
116
+ <summary>Small demonstration using netcat</summary>
117
+
118
+ ![Example of a simple netcat session](gif/server-demo.gif)
119
+
120
+ <details>
121
+ <summary>Used <a href="https://github.com/charmbracelet/vhs">vhs</a> code</summary>
122
+
123
+ \`\`\`vhs
124
+ Output demo.gif
125
+
126
+ Set FontSize 40
127
+ Set Width 1800
128
+ Set Height 750
129
+ Set WindowBar Colorful
130
+ Set TypingSpeed 0.05s
131
+ Set CursorBlink true
132
+
133
+ Type "netcat 127.0.0.1 1042"
134
+ Sleep 200ms
135
+ Enter
136
+ Sleep 600ms
137
+
138
+ Type '{"type":"request-file-analysis","filetoken":"x","filename":"example-input","content":"2 - x"}'
139
+ Sleep 200ms
140
+ Enter
141
+ Sleep 2s
142
+
143
+ Type '{"type":"request-slice","filetoken":"x","criterion":["1@x"]}'
144
+ Sleep 200ms
145
+ Enter
146
+ Sleep 8s
147
+
148
+ Ctrl+C
149
+ Sleep 200ms
150
+ \`\`\`
151
+
152
+ </details>
153
+ </details>
154
+
155
+ The server allows accessing the REPL as well
156
+ (see the ${ctx.linkPage('wiki/Interface')} wiki page for more information).
157
+
158
+ ## Calling the Scripts Directly
159
+
160
+ This describes the old way of using _flowR_ by creating and calling the respective scripts directly.
161
+ Although this is no longer necessary, the scripts still remain, fully integrated into the REPL of _flowR_ (you can access them simply by adding a colon \`:\` before the name).
162
+
163
+ ### Generate Static Slices
164
+
165
+ To generate a slice, you need to provide two things:
166
+
167
+ 1. A [slicing criterion](https://github.com/flowr-analysis/flowr/wiki/Terminology#slicing-criterion): the location of a single variable or several variables of interest to slice for, like "\`12@product\`"
168
+ 2. The path to an R&nbsp;file that should be sliced.
169
+
170
+ For example, from the \`cli\` directory, you can run
171
+
172
+ \`\`\`shell
173
+ npm run slicer -- --criterion "12@product" "test/testfiles/example.R"
174
+ \`\`\`
175
+
176
+ This slices for the first use of the variable \`product\` in line&nbsp;12 of the source file at \`test/testfiles/example.R\` (see the [slicing criterion](https://github.com/flowr-analysis/flowr/wiki/Terminology#slicing-criterion) definition for more information).
177
+ By default, the resulting slice is output to the standard output.
178
+
179
+ For more options, run the following from the \`cli\` directory:
180
+
181
+ \`\`\`shell
182
+ npm run slicer -- --help
183
+ \`\`\`
184
+
185
+ Now, the following alternative is to be preferred:
186
+
187
+ \`\`\`shell
188
+ flowr -e ":slicer --help"
189
+ \`\`\`
190
+
191
+ ### Benchmark the Slicer
192
+
193
+ Within the original [thesis](https://github.com/flowr-analysis/flowr/wiki/Thesis), I conducted a benchmark of the slicer, measuring:
194
+
195
+ 1. The required time of each step of the slicing process, and
196
+ 2. The achieved reductions in the size of the slice.
197
+
198
+ The corresponding _benchmark_ script ultimately allows doing the same thing as the _slicing_ script, but 1) parallel for many files and 2) for a wider selection of slicing points.
199
+ By default, it starts by collecting all variables in a script, producing a slice for each of them.
200
+
201
+ For example, to run the benchmark on 500 randomly picked files of the folder \`<folder>\` using 8 threads and writing the output to \`<output.json>\`, you can run this from the \`cli\` directory:
202
+
203
+ \`\`\`shell
204
+ npm run benchmark -- --limit 500 --parallel 8 --output "<output.json>" "<folder>"
205
+ \`\`\`
206
+
207
+ For more options, run the following from the \`cli\` directory:
208
+
209
+ \`\`\`shell
210
+ npm run benchmark -- --help
211
+ \`\`\`
212
+
213
+ #### Summarizing the Benchmark Results
214
+
215
+ The resulting JSON file can be rather larger (starting off with a couple of hundred megabytes). Therefore, you probably want to summarize the results of the benchmark.
216
+ For this, you can make use of the _summarizer_ script from within the \`cli\` directory like this:
217
+
218
+ \`\`\`shell
219
+ npm run summarizer -- "<output.json>"
220
+ \`\`\`
221
+
222
+ Please note that the summarizer may require a long time as it parses, normalizes, and analyzes _each_ slice produced, to calculate the reduction numbers. Therefore, it actually executes two steps:
223
+
224
+ 1. For each file, it calculates the reduction, required time, and other information, written to \`<output-summary.json>\`
225
+ 2. Calculate the "ultimate" summary by aggregating the intermediate results for each file
226
+
227
+ As the ultimate summary is much quicker, you can re-run it by specifically adding the \`--ultimate-only\` flag (although this is only really of use if you modify what should be summarized within the source code of _flowR_).
228
+
229
+ For more options, run the following from the \`cli\` directory:
230
+
231
+ \`\`\`shell
232
+ npm run summarizer -- --help
233
+ \`\`\`
234
+
235
+ ### Generate Usage Statistics of R Code
236
+
237
+ If you want to reproduce the statistics as presented in the original [master's thesis](http://dx.doi.org/10.18725/OPARU-50107), see the corresponding [wiki page](https://github.com/flowr-analysis/flowr/wiki/Thesis#how-to-reproduce-the-statistics-from-the-masters-thesis).
238
+
239
+ For more information, run the following from the \`cli\` directory:
240
+
241
+ \`\`\`shell
242
+ npm run stats -- --help
243
+ \`\`\`
244
+ `.trim();
245
+ }
246
+ }
247
+ exports.WikiOverview = WikiOverview;
248
+ //# sourceMappingURL=wiki-overview.js.map
@@ -3,7 +3,7 @@ import { DocMaker } from './wiki-mk/doc-maker';
3
3
  /**
4
4
  * https://github.com/flowr-analysis/flowr/wiki/Query-API
5
5
  */
6
- export declare class WikiQuery extends DocMaker {
6
+ export declare class WikiQuery extends DocMaker<'wiki/Query API.md'> {
7
7
  constructor();
8
8
  protected text({ ctx, shell }: DocMakerArgs): Promise<string>;
9
9
  }
@@ -34,6 +34,7 @@ const doc_repl_1 = require("./doc-util/doc-repl");
34
34
  const inspect_higher_order_query_executor_1 = require("../queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor");
35
35
  const doc_escape_1 = require("./doc-util/doc-escape");
36
36
  const doc_maker_1 = require("./wiki-mk/doc-maker");
37
+ const files_query_executor_1 = require("../queries/catalog/files-query/files-query-executor");
37
38
  (0, doc_query_1.registerQueryDocumentation)('call-context', {
38
39
  name: 'Call-Context Query',
39
40
  type: 'active',
@@ -123,6 +124,21 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
123
124
  `;
124
125
  }
125
126
  });
127
+ (0, doc_query_1.registerQueryDocumentation)('files', {
128
+ name: 'Files Query',
129
+ type: 'active',
130
+ shortDescription: 'Returns the files matching the given criteria.',
131
+ functionName: files_query_executor_1.executeFileQuery.name,
132
+ functionFile: '../queries/catalog/files-query/files-query-executor.ts',
133
+ buildExplanation: async (shell) => {
134
+ return `
135
+ This query returns the files that match the given criteria.
136
+ ${await (0, doc_query_1.showQuery)(shell, '', [{
137
+ type: 'files'
138
+ }], { showCode: true, collapseQuery: true })}
139
+ `;
140
+ }
141
+ });
126
142
  (0, doc_query_1.registerQueryDocumentation)('project', {
127
143
  name: 'Project Query',
128
144
  type: 'active',
@@ -645,7 +661,7 @@ class WikiQuery extends doc_maker_1.DocMaker {
645
661
  async text({ ctx, shell }) {
646
662
  return `
647
663
  This page briefly summarizes flowR's query API, represented by the ${query_1.executeQueries.name} function in ${(0, doc_files_1.getFilePathMd)('../queries/query.ts')}.
648
- Please see the [Interface](${doc_files_1.FlowrWikiBaseRef}/Interface) wiki page for more information on how to access this API.
664
+ Please see the ${ctx.linkPage('wiki/Interface')} wiki page for more information on how to access this API.
649
665
 
650
666
  ${(0, doc_structure_1.block)({
651
667
  type: 'NOTE',
@@ -3,7 +3,7 @@ import { DocMaker } from './wiki-mk/doc-maker';
3
3
  /**
4
4
  * https://github.com/flowr-analysis/flowr/wiki/Search-API
5
5
  */
6
- export declare class WikiSearch extends DocMaker {
6
+ export declare class WikiSearch extends DocMaker<'wiki/Search API.md'> {
7
7
  constructor();
8
8
  text({ ctx, shell }: DocMakerArgs): Promise<string>;
9
9
  }
@@ -0,0 +1,9 @@
1
+ import type { DocMakerArgs } from './wiki-mk/doc-maker';
2
+ import { DocMaker } from './wiki-mk/doc-maker';
3
+ /**
4
+ * https://github.com/flowr-analysis/flowr/wiki/Setup
5
+ */
6
+ export declare class WikiSetup extends DocMaker<'wiki/Setup.md'> {
7
+ constructor();
8
+ text({ ctx }: DocMakerArgs): string;
9
+ }
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WikiSetup = void 0;
4
+ const doc_maker_1 = require("./wiki-mk/doc-maker");
5
+ const doc_files_1 = require("./doc-util/doc-files");
6
+ /**
7
+ * https://github.com/flowr-analysis/flowr/wiki/Setup
8
+ */
9
+ class WikiSetup extends doc_maker_1.DocMaker {
10
+ constructor() {
11
+ super('wiki/Setup.md', module.filename, 'setup instructions');
12
+ }
13
+ text({ ctx }) {
14
+ return `
15
+ There are several ways to use _flowR_.
16
+ You can download and build it from source, download the accompanying [docker image](${doc_files_1.FlowrDockerRef}),
17
+ or use its [Visual Studio Code extension](${doc_files_1.FlowrVsCode}) and [RStudio Addin](${doc_files_1.FlowrRStudioAddin}).
18
+
19
+ - [🗒️ Using the Visual Studio Code Extension](#-using-the-visual-studio-code-extension)
20
+ - [🗒️ Using the RStudio Addin](#-using-the-rstudio-addin)
21
+ - [🐳️ Using the Docker Image](#-using-the-docker-image)
22
+ - [⚒️ Building From Scratch](#-building-from-scratch)
23
+ - [📜 Developing for _flowR_](#-developing-for-flowr)
24
+
25
+
26
+ If you want to develop for _flowR_, you want to see how to [build from scratch](#-building-from-scratch) and have a
27
+ look at the [Contributing Guidelines](https://github.com/flowr-analysis/flowr/tree/main//.github/CONTRIBUTING.md).
28
+
29
+ ## 🗒️ Using the Visual Studio Code Extension
30
+
31
+ The easiest way to use _flowR_ is to install the [Visual Studio Code extension](${doc_files_1.FlowrVsCode}).
32
+ The extension directly includes a version of _flowR_ that can be used by default, so you can start analyzing code right away (given that you have R installed on your system).
33
+ Please check out the marketplace entry for more information.
34
+ This extension works with Positron as well (in general, it is available on [open-vsx](${doc_files_1.FlowrPositron}) as well).
35
+
36
+ ## 🗒️ Using the RStudio Addin
37
+
38
+ You can also use _flowR_ as an RStudio Addin. Please check out the [RStudio Addin repository](${doc_files_1.FlowrRStudioAddin}) for more information on how to get started!
39
+
40
+ ## 🐳️ Using the Docker Image
41
+
42
+ You can get the image from [docker hub](${doc_files_1.FlowrDockerRef}) by running:
43
+
44
+ \`\`\`shell
45
+ docker pull eagleoutice/flowr
46
+ \`\`\`
47
+
48
+ Afterward, you can test if the installation was successful by running the following (currently, there is no helper script for that):
49
+
50
+ \`\`\`shell
51
+ docker run -it --rm eagleoutice/flowr
52
+ \`\`\`
53
+
54
+ This should drop you into _flowR_'s read-evaluate-print loop.
55
+ Enter ${ctx.replCmd('help')} to receive more information and ${ctx.replCmd('quit')} to leave.
56
+ Please remember that you have to link external directories to make them available within the running container.
57
+
58
+ To start flowr as a server, you can run:
59
+
60
+ \`\`\`shell
61
+ docker run -it --rm -p1042:1042 eagleoutice/flowr --server
62
+ \`\`\`
63
+
64
+ For more information, see the ${ctx.linkPage('wiki/Interface')} wiki page.
65
+
66
+ ## ⚒️ Building From Scratch
67
+
68
+ To use _flowR_, you may need [_R_](https://www.r-project.org/) installed and on your path
69
+ (this only affects the [\`r-shell\` engine][r-shell], which is _not_ the default).
70
+
71
+ ### Installing R
72
+ Although there are several ways to do so, there is nothing wrong with installing&nbsp;R with the help of your favorite package manager or directly from the [website](https://cloud.r-project.org/).<a href="#note1" id="note1ref"><sup>&lt;1&gt;</sup></a>
73
+ For 🪟&nbsp;Windows, see [here](https://www.hanss.info/sebastian/post/rtools-path/) for an explanation on how to add [_R_](https://www.r-project.org/) to your path variable.
74
+ Again, you only require this for the [\`r-shell\` engine][r-shell].
75
+
76
+ ### Installing Node.js
77
+
78
+ Furthermore, you need the [node package manager](https://www.npmjs.com/) (for Linux, we recommend using [nvm](https://github.com/nvm-sh/nvm)).
79
+ To work, we currently rely on node versions starting from \`22.x\`.
80
+
81
+ ### Installing _flowR_
82
+
83
+ After cloning the repository,<a href="#note2" id="note2ref"><sup>&lt;2&gt;</sup></a> you can install the dependencies with:
84
+
85
+ \`\`\`shell
86
+ npm i
87
+ \`\`\`
88
+
89
+ After that, you should be fine! You may test _flowR_'s command-line interface by running the following from the \`cli\` directory:
90
+
91
+ \`\`\`shell
92
+ npm run slicer -- --criterion "12@product" test/testfiles/example.R
93
+ \`\`\`
94
+
95
+ The output should look similar to this:
96
+
97
+ \`\`\`R
98
+ product <- 1
99
+ N <- 10
100
+ for(i in 1:(N-1)) product <- product * i
101
+ cat("Product:", product, "\\n")
102
+ \`\`\`
103
+
104
+ At the time of writing this, there is currently no page for frequently encountered errors. So just [message me](mailto:florian.sihler@uni-ulm.de) in case of problems.
105
+
106
+ ## 📜 Developing for _flowR_
107
+
108
+ If you want to develop for _flowR_, explore the wiki.
109
+ For details on _how_ to contribute, please refer to the [CONTRIBUTING.md](https://github.com/flowr-analysis/flowr/blob/main/.github/CONTRIBUTING.md) in the repository.
110
+
111
+ -----
112
+ <a id="note1" href="#note1ref">&lt;1&gt;</a>: Currently, _flowR_ is only tested with R versions \`4.x\` and \`3.6.x\`.
113
+
114
+ <a id="note2" href="#note2ref">&lt;2&gt;</a>: We use
115
+ [git-lfs](https://git-lfs.com/) to store larger files, especially for the wiki pages. So if you want to work on these parts, make sure to have it set-up (see the [CONTRIBUTING.md](https://github.com/flowr-analysis/flowr/blob/main/.github/CONTRIBUTING.md) in the repository for more information).
116
+
117
+ [r-shell]: (https://github.com/flowr-analysis/flowr/wiki/Engines)
118
+ `.trim();
119
+ }
120
+ }
121
+ exports.WikiSetup = WikiSetup;
122
+ //# sourceMappingURL=wiki-setup.js.map
@@ -2,7 +2,7 @@ import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/proces
2
2
  import type { FlowrSearchElements } from '../../search/flowr-search';
3
3
  import { type MergeableRecord } from '../../util/objects';
4
4
  import { type SourceRange } from '../../util/range';
5
- import { type LintingResult, LintingRuleCertainty } from '../linter-format';
5
+ import { LintingRuleCertainty, type LintingResult } from '../linter-format';
6
6
  import { LintingRuleTag } from '../linter-tags';
7
7
  export interface DataFrameAccessValidationResult extends LintingResult {
8
8
  /** The type of the data frame access ("column" or "row") */
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DATA_FRAME_ACCESS_VALIDATION = void 0;
4
- const absint_info_1 = require("../../abstract-interpretation/data-frame/absint-info");
5
4
  const shape_inference_1 = require("../../abstract-interpretation/data-frame/shape-inference");
6
5
  const satisfiable_domain_1 = require("../../abstract-interpretation/domains/satisfiable-domain");
7
6
  const config_1 = require("../../config");
@@ -28,14 +27,15 @@ exports.DATA_FRAME_ACCESS_VALIDATION = {
28
27
  })
29
28
  };
30
29
  const cfg = (0, extract_cfg_1.extractCfg)(data.normalize, ctx, data.dataflow.graph);
31
- (0, shape_inference_1.inferDataFrameShapes)(cfg, data.dataflow.graph, data.normalize, ctx);
32
- const accessOperations = getAccessOperations(elements);
30
+ const inference = new shape_inference_1.DataFrameShapeInferenceVisitor({ controlFlow: cfg, dfg: data.dataflow.graph, normalizedAst: data.normalize, ctx });
31
+ inference.start();
32
+ const accessOperations = getAccessOperations(elements, inference);
33
33
  const accesses = [];
34
34
  for (const [nodeId, operations] of accessOperations) {
35
35
  const access = { nodeId };
36
36
  for (const operation of operations) {
37
37
  access.operand ??= operation.operand;
38
- access.operandShape ??= (0, shape_inference_1.resolveIdToDataFrameShape)(operation.operand, data.dataflow.graph);
38
+ access.operandShape ??= inference.getAbstractValue(operation.operand);
39
39
  if (operation.operation === 'accessCols' && operation.columns !== undefined) {
40
40
  access.accessedCols ??= [];
41
41
  access.accessedCols.push(...operation.columns);
@@ -89,13 +89,11 @@ exports.DATA_FRAME_ACCESS_VALIDATION = {
89
89
  defaultConfig: { readLoadedData: false }
90
90
  }
91
91
  };
92
- function getAccessOperations(elements) {
92
+ function getAccessOperations(elements, inference) {
93
93
  return new Map(elements.getElements()
94
- .map(element => element.node)
95
- .filter(absint_info_1.hasDataFrameExpressionInfo)
96
- .map(node => [node.info.id, node.info.dataFrame.operations
97
- .filter(({ operation }) => operation === 'accessCols' || operation === 'accessRows')
98
- .map(({ operation, operand, type: _type, options: _options, ...args }) => ({ operation, operand, ...args }))
94
+ .map(element => [element.node.info.id, inference.getAbstractOperations(element.node.info.id)
95
+ ?.filter(({ operation }) => operation === 'accessCols' || operation === 'accessRows')
96
+ .map(({ operation, operand, type: _type, options: _options, ...args }) => ({ operation, operand, ...args })) ?? []
99
97
  ])
100
98
  .filter(([, operations]) => operations.length > 0));
101
99
  }
@@ -20,7 +20,7 @@ function getDefinitionArguments(def, dfg) {
20
20
  function buildQuickFix(variable, dfg, ast) {
21
21
  // first we check whether any of the 'Defined by' targets have any obligations - if so, we can not remove the definition
22
22
  // otherwise we can automatically remove the full definition!
23
- if (variable.info.role === "accessed" /* RoleInParent.Accessed */ || variable.info.role === "for-variable" /* RoleInParent.ForVariable */) {
23
+ if (variable.info.role === "accessed" /* RoleInParent.Accessed */ || variable.info.role === "for-var" /* RoleInParent.ForVariable */) {
24
24
  // this is an access or a for variable, we can not remove it currently
25
25
  return undefined;
26
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eagleoutice/flowr",
3
- "version": "2.7.0",
3
+ "version": "2.7.2",
4
4
  "description": "Static Dataflow Analyzer and Program Slicer for the R Programming Language",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "repository": {
@@ -28,6 +28,10 @@ export interface ReadOnlyFlowrAnalyzerContext {
28
28
  * The configuration options used by the analyzer.
29
29
  */
30
30
  readonly config: FlowrConfigOptions;
31
+ /**
32
+ * Run all resolution steps that can be done before the main analysis run.
33
+ */
34
+ readonly resolvePreAnalysis: () => void;
31
35
  }
32
36
  /**
33
37
  * This summarizes the other context layers used by the {@link FlowrAnalyzer}.
@@ -4,7 +4,8 @@ import type { FlowrAnalyzerLoadingOrderContext, ReadOnlyFlowrAnalyzerLoadingOrde
4
4
  import { FlowrAnalyzerProjectDiscoveryPlugin } from '../plugins/project-discovery/flowr-analyzer-project-discovery-plugin';
5
5
  import { FlowrAnalyzerFilePlugin } from '../plugins/file-plugins/flowr-analyzer-file-plugin';
6
6
  import { FlowrFile, type FlowrFileProvider, FileRole } from './flowr-file';
7
- import type { FlowrDescriptionFile } from '../plugins/file-plugins/flowr-description-file';
7
+ import type { FlowrDescriptionFile } from '../plugins/file-plugins/files/flowr-description-file';
8
+ import type { FlowrNewsFile } from '../plugins/file-plugins/files/flowr-news-file';
8
9
  /**
9
10
  * This is a request to process a folder as a project, which will be expanded by the registered {@link FlowrAnalyzerProjectDiscoveryPlugin}s.
10
11
  */
@@ -18,6 +19,7 @@ export interface RProjectAnalysisRequest {
18
19
  export type RAnalysisRequest = RParseRequest | RProjectAnalysisRequest;
19
20
  export type RoleBasedFiles = {
20
21
  [FileRole.Description]: FlowrDescriptionFile[];
22
+ [FileRole.News]: FlowrNewsFile[];
21
23
  [FileRole.Namespace]: FlowrFileProvider[];
22
24
  [FileRole.Source]: FlowrFileProvider[];
23
25
  [FileRole.Data]: FlowrFileProvider[];
@@ -45,6 +47,11 @@ export interface ReadOnlyFlowrAnalyzerFilesContext {
45
47
  * ```
46
48
  */
47
49
  getFilesByRole<Role extends FileRole>(role: Role): RoleBasedFiles[Role];
50
+ /**
51
+ * Get all files known to this context.
52
+ * @returns An array of all files.
53
+ */
54
+ getAllFiles(): FlowrFileProvider[];
48
55
  /**
49
56
  * Check if the context has a file with the given path.
50
57
  * Please note, that this may also check the file system, depending on the configuration
@@ -132,4 +139,5 @@ export declare class FlowrAnalyzerFilesContext extends AbstractFlowrAnalyzerCont
132
139
  */
133
140
  computeLoadingOrder(): readonly RParseRequest[];
134
141
  getFilesByRole<Role extends FileRole>(role: Role): RoleBasedFiles[Role];
142
+ getAllFiles(): FlowrFileProvider[];
135
143
  }
@@ -42,6 +42,7 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
42
42
  /* files that are part of the analysis, e.g. source files */
43
43
  byRole = {
44
44
  [flowr_file_1.FileRole.Description]: [],
45
+ [flowr_file_1.FileRole.News]: [],
45
46
  [flowr_file_1.FileRole.Namespace]: [],
46
47
  [flowr_file_1.FileRole.Source]: [],
47
48
  [flowr_file_1.FileRole.Data]: [],
@@ -200,6 +201,9 @@ class FlowrAnalyzerFilesContext extends abstract_flowr_analyzer_context_1.Abstra
200
201
  getFilesByRole(role) {
201
202
  return this.byRole[role];
202
203
  }
204
+ getAllFiles() {
205
+ return [...this.files.values(), ...this.inlineFiles];
206
+ }
203
207
  }
204
208
  exports.FlowrAnalyzerFilesContext = FlowrAnalyzerFilesContext;
205
209
  //# sourceMappingURL=flowr-analyzer-files-context.js.map
@@ -15,6 +15,8 @@ export declare enum FileRole {
15
15
  Description = "description",
16
16
  /** The `NAMESPACE` file in R packages, currently not specially supported. */
17
17
  Namespace = "namespace",
18
+ /** The `NEWS` file in R packages */
19
+ News = "news",
18
20
  /** Data files, e.g., `R/sysdata.rda`, currently not specially supported. */
19
21
  Data = "data",
20
22
  /**
@@ -17,6 +17,8 @@ var FileRole;
17
17
  FileRole["Description"] = "description";
18
18
  /** The `NAMESPACE` file in R packages, currently not specially supported. */
19
19
  FileRole["Namespace"] = "namespace";
20
+ /** The `NEWS` file in R packages */
21
+ FileRole["News"] = "news";
20
22
  /** Data files, e.g., `R/sysdata.rda`, currently not specially supported. */
21
23
  FileRole["Data"] = "data";
22
24
  /**
@@ -1,4 +1,4 @@
1
- import { type FlowrFileProvider, type FileRole, FlowrFile } from '../../context/flowr-file';
1
+ import { type FlowrFileProvider, type FileRole, FlowrFile } from '../../../context/flowr-file';
2
2
  export type DCF = Map<string, string[]>;
3
3
  /**
4
4
  * This decorates a text file and provides access to its content as a DCF (Debian Control File)-like structure.