@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.
- package/README.md +14 -14
- package/abstract-interpretation/absint-visitor.d.ts +160 -0
- package/abstract-interpretation/absint-visitor.js +279 -0
- package/abstract-interpretation/data-frame/dataframe-domain.d.ts +2 -2
- package/abstract-interpretation/data-frame/dataframe-domain.js +23 -7
- package/abstract-interpretation/data-frame/mappers/access-mapper.d.ts +6 -6
- package/abstract-interpretation/data-frame/mappers/access-mapper.js +10 -14
- package/abstract-interpretation/data-frame/mappers/arguments.d.ts +15 -9
- package/abstract-interpretation/data-frame/mappers/arguments.js +27 -4
- package/abstract-interpretation/data-frame/mappers/function-mapper.d.ts +17 -17
- package/abstract-interpretation/data-frame/mappers/function-mapper.js +55 -67
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.d.ts +7 -7
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +25 -29
- package/abstract-interpretation/data-frame/resolve-args.d.ts +1 -1
- package/abstract-interpretation/data-frame/resolve-args.js +1 -1
- package/abstract-interpretation/data-frame/semantics.js +5 -6
- package/abstract-interpretation/data-frame/shape-inference.d.ts +52 -28
- package/abstract-interpretation/data-frame/shape-inference.js +67 -90
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +2 -2
- package/abstract-interpretation/domains/interval-domain.d.ts +2 -2
- package/abstract-interpretation/domains/set-range-domain.d.ts +10 -4
- package/abstract-interpretation/domains/set-range-domain.js +7 -1
- package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +2 -2
- package/abstract-interpretation/domains/singleton-domain.d.ts +2 -2
- package/benchmark/slicer.js +13 -14
- package/cli/common/options.d.ts +431 -8
- package/cli/common/options.js +1 -1
- package/cli/common/scripts-info.d.ts +431 -7
- package/cli/flowr-main-options.d.ts +102 -2
- package/cli/flowr.d.ts +102 -2
- package/cli/repl/commands/repl-commands.d.ts +25 -0
- package/cli/repl/commands/repl-query.js +17 -5
- package/cli/wiki.d.ts +13 -0
- package/cli/wiki.js +7 -2
- package/config.d.ts +4 -4
- package/config.js +1 -1
- package/control-flow/basic-cfg-guided-visitor.js +7 -8
- package/control-flow/control-flow-graph.d.ts +1 -1
- package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +1 -1
- package/dataflow/eval/resolve/alias-tracking.js +1 -1
- package/dataflow/internal/linker.d.ts +2 -0
- package/dataflow/internal/linker.js +10 -12
- package/documentation/doc-capabilities.d.ts +1 -1
- package/documentation/doc-readme.d.ts +1 -1
- package/documentation/doc-util/doc-cfg.js +1 -1
- package/documentation/doc-util/doc-cli-option.d.ts +6 -6
- package/documentation/doc-util/doc-cli-option.js +3 -3
- package/documentation/doc-util/doc-dfg.d.ts +1 -1
- package/documentation/doc-util/doc-files.d.ts +3 -0
- package/documentation/doc-util/doc-files.js +4 -1
- package/documentation/doc-util/doc-normalized-ast.js +2 -2
- package/documentation/issue-linting-rule.d.ts +1 -1
- package/documentation/wiki-analyzer.d.ts +1 -1
- package/documentation/wiki-cfg.d.ts +1 -1
- package/documentation/wiki-core.d.ts +1 -1
- package/documentation/wiki-dataflow-graph.d.ts +1 -1
- package/documentation/wiki-dataflow-graph.js +6 -6
- package/documentation/wiki-engine.d.ts +1 -1
- package/documentation/wiki-engine.js +9 -10
- package/documentation/wiki-faq.d.ts +1 -1
- package/documentation/wiki-interface.d.ts +1 -1
- package/documentation/wiki-interface.js +12 -13
- package/documentation/wiki-linter.d.ts +1 -1
- package/documentation/wiki-linting-and-testing.d.ts +1 -1
- package/documentation/wiki-mk/doc-context.d.ts +54 -1
- package/documentation/wiki-mk/doc-context.js +17 -0
- package/documentation/wiki-mk/doc-maker.d.ts +5 -5
- package/documentation/wiki-mk/doc-maker.js +3 -1
- package/documentation/wiki-normalized-ast.d.ts +1 -1
- package/documentation/wiki-onboarding.d.ts +1 -1
- package/documentation/wiki-overview.d.ts +9 -0
- package/documentation/wiki-overview.js +248 -0
- package/documentation/wiki-query.d.ts +1 -1
- package/documentation/wiki-query.js +17 -1
- package/documentation/wiki-search.d.ts +1 -1
- package/documentation/wiki-setup.d.ts +9 -0
- package/documentation/wiki-setup.js +122 -0
- package/linter/rules/dataframe-access-validation.d.ts +1 -1
- package/linter/rules/dataframe-access-validation.js +8 -10
- package/linter/rules/unused-definition.js +1 -1
- package/package.json +1 -1
- package/project/context/flowr-analyzer-context.d.ts +4 -0
- package/project/context/flowr-analyzer-context.js +3 -1
- package/project/context/flowr-analyzer-dependencies-context.d.ts +3 -2
- package/project/context/flowr-analyzer-dependencies-context.js +4 -2
- package/project/context/flowr-analyzer-files-context.d.ts +9 -1
- package/project/context/flowr-analyzer-files-context.js +4 -0
- package/project/context/flowr-analyzer-functions-context.d.ts +29 -0
- package/project/context/flowr-analyzer-functions-context.js +68 -0
- package/project/context/flowr-file.d.ts +2 -0
- package/project/context/flowr-file.js +2 -0
- package/project/plugins/file-plugins/{flowr-description-file.d.ts → files/flowr-description-file.d.ts} +1 -1
- package/project/plugins/file-plugins/files/flowr-description-file.js +75 -0
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +32 -0
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +102 -0
- package/project/plugins/file-plugins/files/flowr-news-file.d.ts +27 -0
- package/project/plugins/file-plugins/files/flowr-news-file.js +152 -0
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
- package/project/plugins/file-plugins/flowr-analyzer-namespace-file-plugin.d.ts +22 -0
- package/project/plugins/file-plugins/flowr-analyzer-namespace-file-plugin.js +34 -0
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.d.ts +23 -0
- package/project/plugins/file-plugins/flowr-analyzer-news-file-plugin.js +35 -0
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin.js +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +1 -1
- package/project/plugins/flowr-analyzer-plugin-defaults.js +4 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +5 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.d.ts +10 -0
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-namespace-file-plugin.js +56 -0
- package/project/plugins/package-version-plugins/package.d.ts +15 -2
- package/project/plugins/package-version-plugins/package.js +33 -5
- package/project/plugins/plugin-registry.d.ts +3 -1
- package/project/plugins/plugin-registry.js +4 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +7 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -1
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +2 -0
- package/queries/catalog/dependencies-query/dependencies-query-format.js +2 -1
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +4 -2
- package/queries/catalog/files-query/files-query-executor.d.ts +6 -0
- package/queries/catalog/files-query/files-query-executor.js +49 -0
- package/queries/catalog/files-query/files-query-format.d.ts +36 -0
- package/queries/catalog/files-query/files-query-format.js +114 -0
- package/queries/catalog/linter-query/linter-query-format.js +1 -1
- package/queries/query.d.ts +10 -1
- package/queries/query.js +3 -1
- package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +8 -8
- package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +8 -8
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +0 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +0 -1
- package/statistics/features/supported/data-access/data-access.js +1 -1
- package/util/containers.js +1 -1
- package/util/files.d.ts +0 -7
- package/util/files.js +0 -41
- package/util/mermaid/ast.d.ts +3 -2
- package/util/mermaid/ast.js +13 -7
- package/util/mermaid/cfg.d.ts +3 -2
- package/util/mermaid/cfg.js +26 -6
- package/util/mermaid/dfg.d.ts +1 -7
- package/util/mermaid/dfg.js +7 -3
- package/util/mermaid/info.d.ts +17 -0
- package/util/mermaid/info.js +5 -0
- package/util/prefix.d.ts +9 -5
- package/util/prefix.js +14 -6
- package/util/r-regex.d.ts +21 -0
- package/util/r-regex.js +25 -0
- package/util/text/args.js +12 -3
- package/util/version.js +1 -1
- package/abstract-interpretation/data-frame/absint-info.d.ts +0 -109
- package/abstract-interpretation/data-frame/absint-info.js +0 -31
- package/abstract-interpretation/data-frame/absint-visitor.d.ts +0 -57
- package/abstract-interpretation/data-frame/absint-visitor.js +0 -176
- package/abstract-interpretation/data-frame/mappers/assignment-mapper.d.ts +0 -21
- package/abstract-interpretation/data-frame/mappers/assignment-mapper.js +0 -34
- package/documentation/doc-util/doc-print.d.ts +0 -5
- package/documentation/doc-util/doc-print.js +0 -36
- package/project/plugins/file-plugins/flowr-description-file.js +0 -37
- package/project/plugins/file-plugins/notebooks/notebook.d.ts +0 -0
- package/project/plugins/file-plugins/notebooks/notebook.js +0 -2
- /package/project/plugins/file-plugins/{notebooks → files}/flowr-jupyter-file.d.ts +0 -0
- /package/project/plugins/file-plugins/{notebooks → files}/flowr-jupyter-file.js +0 -0
- /package/project/plugins/file-plugins/{notebooks → files}/flowr-rmarkdown-file.d.ts +0 -0
- /package/project/plugins/file-plugins/{notebooks → files}/flowr-rmarkdown-file.js +0 -0
|
@@ -102,7 +102,7 @@ export interface Namespace {
|
|
|
102
102
|
* The namespace attached to the given node
|
|
103
103
|
* (e.g., a namespaced symbol in `x::y`).
|
|
104
104
|
*/
|
|
105
|
-
namespace
|
|
105
|
+
namespace?: NamespaceIdentifier;
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
108
|
* This subtype of {@link RNode} represents all types of constants
|
|
@@ -187,7 +187,7 @@ function createFoldForUnaryOp(info) {
|
|
|
187
187
|
info.idMap.set(id, decorated);
|
|
188
188
|
const opInfo = operand.info;
|
|
189
189
|
opInfo.parent = id;
|
|
190
|
-
opInfo.role = "unary-
|
|
190
|
+
opInfo.role = "unary-op" /* RoleInParent.UnaryOperand */;
|
|
191
191
|
decorated.info.file = info.file;
|
|
192
192
|
return decorated;
|
|
193
193
|
};
|
|
@@ -208,7 +208,7 @@ function createFoldForAccess(info) {
|
|
|
208
208
|
const curInfo = acc.info;
|
|
209
209
|
curInfo.parent = id;
|
|
210
210
|
curInfo.index = idx;
|
|
211
|
-
curInfo.role = "index-
|
|
211
|
+
curInfo.role = "index-acc" /* RoleInParent.IndexAccess */;
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
}
|
|
@@ -223,11 +223,11 @@ function createFoldForForLoop(info) {
|
|
|
223
223
|
info.idMap.set(id, decorated);
|
|
224
224
|
const varInfo = variable.info;
|
|
225
225
|
varInfo.parent = id;
|
|
226
|
-
varInfo.role = "for-
|
|
226
|
+
varInfo.role = "for-var" /* RoleInParent.ForVariable */;
|
|
227
227
|
const vecInfo = vector.info;
|
|
228
228
|
vecInfo.parent = id;
|
|
229
229
|
vecInfo.index = 1;
|
|
230
|
-
vecInfo.role = "for-
|
|
230
|
+
vecInfo.role = "for-vec" /* RoleInParent.ForVector */;
|
|
231
231
|
const bodyInfo = body.info;
|
|
232
232
|
bodyInfo.parent = id;
|
|
233
233
|
bodyInfo.index = 2;
|
|
@@ -280,7 +280,7 @@ function createFoldForIfThenElse(info) {
|
|
|
280
280
|
const otherwiseInfo = otherwise.info;
|
|
281
281
|
otherwiseInfo.parent = id;
|
|
282
282
|
otherwiseInfo.index = 2;
|
|
283
|
-
otherwiseInfo.role = "if-
|
|
283
|
+
otherwiseInfo.role = "if-other" /* RoleInParent.IfOtherwise */;
|
|
284
284
|
}
|
|
285
285
|
decorated.info.file = info.file;
|
|
286
286
|
return decorated;
|
|
@@ -323,7 +323,7 @@ function createFoldForFunctionCall(info) {
|
|
|
323
323
|
const argInfo = arg.info;
|
|
324
324
|
argInfo.parent = id;
|
|
325
325
|
argInfo.index = idx;
|
|
326
|
-
argInfo.role = "call-
|
|
326
|
+
argInfo.role = "call-arg" /* RoleInParent.FunctionCallArgument */;
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
decorated.info.file = info.file;
|
|
@@ -340,12 +340,12 @@ function createFoldForFunctionDefinition(info) {
|
|
|
340
340
|
const paramInfo = param.info;
|
|
341
341
|
paramInfo.parent = id;
|
|
342
342
|
paramInfo.index = idx++;
|
|
343
|
-
paramInfo.role = "
|
|
343
|
+
paramInfo.role = "param" /* RoleInParent.FunctionDefinitionParameter */;
|
|
344
344
|
}
|
|
345
345
|
const bodyInfo = body.info;
|
|
346
346
|
bodyInfo.parent = id;
|
|
347
347
|
bodyInfo.index = idx;
|
|
348
|
-
bodyInfo.role = "
|
|
348
|
+
bodyInfo.role = "fun-body" /* RoleInParent.FunctionDefinitionBody */;
|
|
349
349
|
decorated.info.file = info.file;
|
|
350
350
|
return decorated;
|
|
351
351
|
};
|
|
@@ -10,29 +10,29 @@ export declare const enum RoleInParent {
|
|
|
10
10
|
Root = "root",
|
|
11
11
|
IfCondition = "if-cond",
|
|
12
12
|
IfThen = "if-then",
|
|
13
|
-
IfOtherwise = "if-
|
|
13
|
+
IfOtherwise = "if-other",
|
|
14
14
|
WhileCondition = "while-cond",
|
|
15
15
|
WhileBody = "while-body",
|
|
16
16
|
RepeatBody = "repeat-body",
|
|
17
|
-
ForVariable = "for-
|
|
18
|
-
ForVector = "for-
|
|
17
|
+
ForVariable = "for-var",
|
|
18
|
+
ForVector = "for-vec",
|
|
19
19
|
ForBody = "for-body",
|
|
20
20
|
FunctionCallName = "call-name",
|
|
21
|
-
FunctionCallArgument = "call-
|
|
22
|
-
FunctionDefinitionBody = "
|
|
23
|
-
FunctionDefinitionParameter = "
|
|
21
|
+
FunctionCallArgument = "call-arg",
|
|
22
|
+
FunctionDefinitionBody = "fun-body",
|
|
23
|
+
FunctionDefinitionParameter = "param",
|
|
24
24
|
ExpressionListChild = "expr-list-child",
|
|
25
25
|
BinaryOperationLhs = "binop-lhs",
|
|
26
26
|
BinaryOperationRhs = "binop-rhs",
|
|
27
27
|
PipeLhs = "pipe-lhs",
|
|
28
28
|
PipeRhs = "pipe-rhs",
|
|
29
|
-
UnaryOperand = "unary-
|
|
29
|
+
UnaryOperand = "unary-op",
|
|
30
30
|
ParameterName = "param-name",
|
|
31
31
|
ParameterDefaultValue = "param-value",
|
|
32
32
|
ArgumentName = "arg-name",
|
|
33
33
|
ArgumentValue = "arg-value",
|
|
34
34
|
Accessed = "accessed",
|
|
35
|
-
IndexAccess = "index-
|
|
35
|
+
IndexAccess = "index-acc"
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Returns the roles of the parents of the given node, starting with the parent-role of the node itself.
|
|
@@ -58,7 +58,7 @@ function visitAccess(info, input) {
|
|
|
58
58
|
acc = true;
|
|
59
59
|
break; // we only account for the first one
|
|
60
60
|
}
|
|
61
|
-
else if (role === "index-
|
|
61
|
+
else if (role === "index-acc" /* RoleInParent.IndexAccess */) {
|
|
62
62
|
idxAcc = true;
|
|
63
63
|
break;
|
|
64
64
|
}
|
package/util/containers.js
CHANGED
|
@@ -16,7 +16,7 @@ const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
|
|
|
16
16
|
function getAccessOperands(args) {
|
|
17
17
|
const nonEmptyArgs = args.filter(arg => arg !== r_function_call_1.EmptyArgument);
|
|
18
18
|
const accessedArg = nonEmptyArgs.find(arg => arg.info.role === "accessed" /* RoleInParent.Accessed */);
|
|
19
|
-
const accessArg = nonEmptyArgs.find(arg => arg.info.role === "index-
|
|
19
|
+
const accessArg = nonEmptyArgs.find(arg => arg.info.role === "index-acc" /* RoleInParent.IndexAccess */);
|
|
20
20
|
return { accessedArg, accessArg };
|
|
21
21
|
}
|
|
22
22
|
/**
|
package/util/files.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type PathLike } from 'fs';
|
|
2
2
|
import type { RParseRequestFromFile } from '../r-bridge/retriever';
|
|
3
|
-
import type { FlowrFileProvider } from '../project/context/flowr-file';
|
|
4
3
|
/**
|
|
5
4
|
* Represents a table, identified by a header and a list of rows.
|
|
6
5
|
*/
|
|
@@ -70,12 +69,6 @@ export declare function readLineByLineSync(filePath: string, onLine: (line: Buff
|
|
|
70
69
|
* @param directory - The directory whose parent to return
|
|
71
70
|
*/
|
|
72
71
|
export declare function getParentDirectory(directory: string): string;
|
|
73
|
-
/**
|
|
74
|
-
* Parses the given file in the 'Debian Control Format'.
|
|
75
|
-
* @param file - The file to parse
|
|
76
|
-
* @returns Map containing the keys and values of the provided file.
|
|
77
|
-
*/
|
|
78
|
-
export declare function parseDCF(file: FlowrFileProvider): Map<string, string[]>;
|
|
79
72
|
/**
|
|
80
73
|
* Checks whether the given path-like object is a file that exists on the local filesystem.
|
|
81
74
|
*/
|
package/util/files.js
CHANGED
|
@@ -44,7 +44,6 @@ exports.writeTableAsCsv = writeTableAsCsv;
|
|
|
44
44
|
exports.readLineByLine = readLineByLine;
|
|
45
45
|
exports.readLineByLineSync = readLineByLineSync;
|
|
46
46
|
exports.getParentDirectory = getParentDirectory;
|
|
47
|
-
exports.parseDCF = parseDCF;
|
|
48
47
|
exports.isFilePath = isFilePath;
|
|
49
48
|
const fs_1 = __importStar(require("fs"));
|
|
50
49
|
const path_1 = __importDefault(require("path"));
|
|
@@ -201,46 +200,6 @@ function getParentDirectory(directory) {
|
|
|
201
200
|
// apparently this is somehow the best way to do it in node, what
|
|
202
201
|
return directory.split(path_1.default.sep).slice(0, -1).join(path_1.default.sep);
|
|
203
202
|
}
|
|
204
|
-
/**
|
|
205
|
-
* Parses the given file in the 'Debian Control Format'.
|
|
206
|
-
* @param file - The file to parse
|
|
207
|
-
* @returns Map containing the keys and values of the provided file.
|
|
208
|
-
*/
|
|
209
|
-
function parseDCF(file) {
|
|
210
|
-
const result = new Map();
|
|
211
|
-
let currentKey = '';
|
|
212
|
-
let currentValue = '';
|
|
213
|
-
const indentRegex = new RegExp(/^\s/);
|
|
214
|
-
const firstColonRegex = new RegExp(/:(.*)/s);
|
|
215
|
-
const fileContent = file.content().toString().split(/\r?\n/);
|
|
216
|
-
for (const line of fileContent) {
|
|
217
|
-
if (indentRegex.test(line)) {
|
|
218
|
-
currentValue += '\n' + line.trim();
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
if (currentKey) {
|
|
222
|
-
const values = currentValue ? cleanValues(currentValue) : [];
|
|
223
|
-
result.set(currentKey, values);
|
|
224
|
-
}
|
|
225
|
-
const [key, rest] = line.split(firstColonRegex).map(s => s.trim());
|
|
226
|
-
currentKey = key.trim();
|
|
227
|
-
currentValue = rest.trim();
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
if (currentKey) {
|
|
231
|
-
const values = currentValue ? cleanValues(currentValue) : [];
|
|
232
|
-
result.set(currentKey, values);
|
|
233
|
-
}
|
|
234
|
-
return result;
|
|
235
|
-
}
|
|
236
|
-
const cleanSplitRegex = /[\n,]+/;
|
|
237
|
-
const cleanQuotesRegex = /'/g;
|
|
238
|
-
function cleanValues(values) {
|
|
239
|
-
return values
|
|
240
|
-
.split(cleanSplitRegex)
|
|
241
|
-
.map(s => s.trim().replace(cleanQuotesRegex, ''))
|
|
242
|
-
.filter(s => s.length > 0);
|
|
243
|
-
}
|
|
244
203
|
/**
|
|
245
204
|
* Checks whether the given path-like object is a file that exists on the local filesystem.
|
|
246
205
|
*/
|
package/util/mermaid/ast.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ParentInformation, RNodeWithParent } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
2
2
|
import type { RProject } from '../../r-bridge/lang-4.x/ast/model/nodes/r-project';
|
|
3
|
+
import type { MermaidGraphPrinterInfo } from './info';
|
|
3
4
|
/**
|
|
4
5
|
* Serialize the normalized AST to mermaid format
|
|
5
6
|
*/
|
|
6
|
-
export declare function normalizedAstToMermaid(ast: RProject<ParentInformation> | RNodeWithParent, prefix?:
|
|
7
|
+
export declare function normalizedAstToMermaid(ast: RProject<ParentInformation> | RNodeWithParent, { prefix, markStyle, includeOnlyIds, mark }?: MermaidGraphPrinterInfo): string;
|
|
7
8
|
/**
|
|
8
9
|
* Use mermaid to visualize the normalized AST.
|
|
9
10
|
*/
|
|
10
|
-
export declare function normalizedAstToMermaidUrl(ast: RProject<ParentInformation> | RNodeWithParent,
|
|
11
|
+
export declare function normalizedAstToMermaidUrl(ast: RProject<ParentInformation> | RNodeWithParent, info?: MermaidGraphPrinterInfo): string;
|
package/util/mermaid/ast.js
CHANGED
|
@@ -7,6 +7,7 @@ const visitor_1 = require("../../r-bridge/lang-4.x/ast/model/processing/visitor"
|
|
|
7
7
|
const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
|
|
8
8
|
const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
|
|
9
9
|
const flowr_file_1 = require("../../project/context/flowr-file");
|
|
10
|
+
const info_1 = require("./info");
|
|
10
11
|
function identifyMermaidDirection(prefix) {
|
|
11
12
|
const directionMatch = prefix.match(/flowchart (TD|LR|RL|BT)/);
|
|
12
13
|
if (directionMatch) {
|
|
@@ -17,14 +18,20 @@ function identifyMermaidDirection(prefix) {
|
|
|
17
18
|
/**
|
|
18
19
|
* Serialize the normalized AST to mermaid format
|
|
19
20
|
*/
|
|
20
|
-
function normalizedAstToMermaid(ast, prefix = 'flowchart TD\n') {
|
|
21
|
+
function normalizedAstToMermaid(ast, { prefix = 'flowchart TD\n', markStyle = info_1.MermaidDefaultMarkStyle, includeOnlyIds, mark } = {}) {
|
|
21
22
|
let output = prefix;
|
|
22
23
|
function showNode(n) {
|
|
24
|
+
if (includeOnlyIds && !includeOnlyIds.has(n.info.id)) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
23
27
|
const name = `${n.type} (${n.info.id})\\n${n.lexeme ?? ' '}`;
|
|
24
28
|
output += ` n${n.info.id}(["${(0, mermaid_1.escapeMarkdown)(name)}"])\n`;
|
|
25
|
-
if (n.info.
|
|
29
|
+
if (mark?.has(n.info.id)) {
|
|
30
|
+
output += ` style n${n.info.id} ${markStyle.vertex}\n`;
|
|
31
|
+
}
|
|
32
|
+
if (n.info.parent !== undefined && (!includeOnlyIds || includeOnlyIds.has(n.info.parent))) {
|
|
26
33
|
const context = n.info;
|
|
27
|
-
const roleSuffix = context.role === "expr-list-child" /* RoleInParent.ExpressionListChild */ || context.role === "call-
|
|
34
|
+
const roleSuffix = context.role === "expr-list-child" /* RoleInParent.ExpressionListChild */ || context.role === "call-arg" /* RoleInParent.FunctionCallArgument */ || context.role === "param" /* RoleInParent.FunctionDefinitionParameter */ ? `-${context.index}` : '';
|
|
28
35
|
output += ` n${n.info.parent} -->|"${context.role}${roleSuffix}"| n${n.info.id}\n`;
|
|
29
36
|
}
|
|
30
37
|
if (n.type === type_1.RType.ExpressionList && n.grouping !== undefined) {
|
|
@@ -49,9 +56,8 @@ function normalizedAstToMermaid(ast, prefix = 'flowchart TD\n') {
|
|
|
49
56
|
for (const f of ast.files) {
|
|
50
57
|
// add a subgraph for each file
|
|
51
58
|
if (ast.files.length !== 1 || (f.filePath && f.filePath !== flowr_file_1.FlowrFile.INLINE_PATH)) {
|
|
52
|
-
output += ` subgraph "File: ${(0, mermaid_1.escapeMarkdown)(f.filePath ?? flowr_file_1.FlowrFile.INLINE_PATH)}"\n`;
|
|
53
59
|
const direction = identifyMermaidDirection(prefix);
|
|
54
|
-
output += `
|
|
60
|
+
output += ` subgraph "File: ${(0, mermaid_1.escapeMarkdown)(f.filePath ?? flowr_file_1.FlowrFile.INLINE_PATH)}" direction ${direction}\n`;
|
|
55
61
|
showAst(f.root);
|
|
56
62
|
output += ' end\n';
|
|
57
63
|
}
|
|
@@ -68,7 +74,7 @@ function normalizedAstToMermaid(ast, prefix = 'flowchart TD\n') {
|
|
|
68
74
|
/**
|
|
69
75
|
* Use mermaid to visualize the normalized AST.
|
|
70
76
|
*/
|
|
71
|
-
function normalizedAstToMermaidUrl(ast,
|
|
72
|
-
return (0, mermaid_1.mermaidCodeToUrl)(normalizedAstToMermaid(ast,
|
|
77
|
+
function normalizedAstToMermaidUrl(ast, info) {
|
|
78
|
+
return (0, mermaid_1.mermaidCodeToUrl)(normalizedAstToMermaid(ast, info ?? {}));
|
|
73
79
|
}
|
|
74
80
|
//# sourceMappingURL=ast.js.map
|
package/util/mermaid/cfg.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { NormalizedAst } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
2
2
|
import { type ControlFlowInformation } from '../../control-flow/control-flow-graph';
|
|
3
|
+
import { type MermaidGraphPrinterInfo } from './info';
|
|
3
4
|
/**
|
|
4
5
|
* Convert the control flow graph to a mermaid string.
|
|
5
6
|
* @param cfg - The control flow graph to convert.
|
|
@@ -7,8 +8,8 @@ import { type ControlFlowInformation } from '../../control-flow/control-flow-gra
|
|
|
7
8
|
* @param prefix - The prefix to use for the mermaid string.
|
|
8
9
|
* @param simplify - Whether to simplify the control flow graph (especially in the context of basic blocks).
|
|
9
10
|
*/
|
|
10
|
-
export declare function cfgToMermaid(cfg: ControlFlowInformation, normalizedAst: NormalizedAst, prefix
|
|
11
|
+
export declare function cfgToMermaid(cfg: ControlFlowInformation, normalizedAst: NormalizedAst, { prefix, simplify, markStyle, includeOnlyIds, mark }?: MermaidGraphPrinterInfo): string;
|
|
11
12
|
/**
|
|
12
13
|
* Use mermaid to visualize the normalized AST.
|
|
13
14
|
*/
|
|
14
|
-
export declare function cfgToMermaidUrl(cfg: ControlFlowInformation, normalizedAst: NormalizedAst,
|
|
15
|
+
export declare function cfgToMermaidUrl(cfg: ControlFlowInformation, normalizedAst: NormalizedAst, info?: MermaidGraphPrinterInfo): string;
|
package/util/mermaid/cfg.js
CHANGED
|
@@ -7,6 +7,7 @@ const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
|
|
|
7
7
|
const control_flow_graph_1 = require("../../control-flow/control-flow-graph");
|
|
8
8
|
const reconstruct_1 = require("../../reconstruct/reconstruct");
|
|
9
9
|
const auto_select_defaults_1 = require("../../reconstruct/auto-select/auto-select-defaults");
|
|
10
|
+
const info_1 = require("./info");
|
|
10
11
|
function getLexeme(n) {
|
|
11
12
|
return n ? n.info.fullLexeme ?? n.lexeme ?? '' : undefined;
|
|
12
13
|
}
|
|
@@ -30,7 +31,7 @@ const getDirRegex = /flowchart\s+([A-Za-z]+)/;
|
|
|
30
31
|
* @param prefix - The prefix to use for the mermaid string.
|
|
31
32
|
* @param simplify - Whether to simplify the control flow graph (especially in the context of basic blocks).
|
|
32
33
|
*/
|
|
33
|
-
function cfgToMermaid(cfg, normalizedAst, prefix = 'flowchart BT\n', simplify = false) {
|
|
34
|
+
function cfgToMermaid(cfg, normalizedAst, { prefix = 'flowchart BT\n', simplify = false, markStyle = info_1.MermaidDefaultMarkStyle, includeOnlyIds, mark } = {}) {
|
|
34
35
|
let output = prefix;
|
|
35
36
|
const dirIs = getDirRegex.exec(prefix)?.at(1) ?? 'LR';
|
|
36
37
|
for (const [id, vertex] of cfg.graph.vertices(false)) {
|
|
@@ -52,6 +53,10 @@ function cfgToMermaid(cfg, normalizedAst, prefix = 'flowchart BT\n', simplify =
|
|
|
52
53
|
output += ` direction ${dirIs}\n`;
|
|
53
54
|
let last = undefined;
|
|
54
55
|
for (const element of vertex.elems ?? []) {
|
|
56
|
+
if (includeOnlyIds && !includeOnlyIds.has(element.id)) {
|
|
57
|
+
last = undefined;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
55
60
|
const childNormalizedVertex = normalizedAst?.idMap.get(element.id);
|
|
56
61
|
const childContent = getLexeme(childNormalizedVertex);
|
|
57
62
|
output = cfgOfNode(vertex, childNormalizedVertex, element.id, childContent, output);
|
|
@@ -64,7 +69,7 @@ function cfgToMermaid(cfg, normalizedAst, prefix = 'flowchart BT\n', simplify =
|
|
|
64
69
|
output += ' end\n';
|
|
65
70
|
}
|
|
66
71
|
}
|
|
67
|
-
else {
|
|
72
|
+
else if (!includeOnlyIds || includeOnlyIds.has(id)) {
|
|
68
73
|
output = cfgOfNode(vertex, normalizedVertex, id, content, output);
|
|
69
74
|
}
|
|
70
75
|
if (vertex.name === type_1.RType.ExpressionList && vertex.type === control_flow_graph_1.CfgVertexType.EndMarker) {
|
|
@@ -72,24 +77,39 @@ function cfgToMermaid(cfg, normalizedAst, prefix = 'flowchart BT\n', simplify =
|
|
|
72
77
|
}
|
|
73
78
|
}
|
|
74
79
|
for (const [from, targets] of cfg.graph.edges()) {
|
|
80
|
+
if (includeOnlyIds && !includeOnlyIds.has(from)) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
75
83
|
for (const [to, edge] of targets) {
|
|
84
|
+
if (includeOnlyIds && !includeOnlyIds.has(to)) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
76
87
|
const edgeType = edge.label === 1 /* CfgEdgeType.Cd */ ? '-->' : '-.->';
|
|
77
88
|
const edgeSuffix = edge.label === 1 /* CfgEdgeType.Cd */ ? ` (${edge.when})` : '';
|
|
78
89
|
output += ` n${from} ${edgeType}|"${(0, mermaid_1.escapeMarkdown)((0, control_flow_graph_1.edgeTypeToString)(edge.label))}${edgeSuffix}"| n${to}\n`;
|
|
79
90
|
}
|
|
80
91
|
}
|
|
81
92
|
for (const entryPoint of cfg.entryPoints) {
|
|
82
|
-
|
|
93
|
+
if (!includeOnlyIds || includeOnlyIds.has(entryPoint)) {
|
|
94
|
+
output += ` style n${entryPoint} stroke:cyan,stroke-width:6.5px;`;
|
|
95
|
+
}
|
|
83
96
|
}
|
|
84
97
|
for (const exitPoint of cfg.exitPoints) {
|
|
85
|
-
|
|
98
|
+
if (!includeOnlyIds || includeOnlyIds.has(exitPoint)) {
|
|
99
|
+
output += ` style n${exitPoint} stroke:green,stroke-width:6.5px;`;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (mark) {
|
|
103
|
+
for (const id of mark.values()) {
|
|
104
|
+
output += ` style n${id} ${markStyle.vertex}`;
|
|
105
|
+
}
|
|
86
106
|
}
|
|
87
107
|
return output;
|
|
88
108
|
}
|
|
89
109
|
/**
|
|
90
110
|
* Use mermaid to visualize the normalized AST.
|
|
91
111
|
*/
|
|
92
|
-
function cfgToMermaidUrl(cfg, normalizedAst,
|
|
93
|
-
return (0, mermaid_1.mermaidCodeToUrl)(cfgToMermaid(cfg, normalizedAst,
|
|
112
|
+
function cfgToMermaidUrl(cfg, normalizedAst, info) {
|
|
113
|
+
return (0, mermaid_1.mermaidCodeToUrl)(cfgToMermaid(cfg, normalizedAst, info ?? {}));
|
|
94
114
|
}
|
|
95
115
|
//# sourceMappingURL=cfg.js.map
|
package/util/mermaid/dfg.d.ts
CHANGED
|
@@ -2,13 +2,7 @@ import type { SourceRange } from '../range';
|
|
|
2
2
|
import { type DataflowGraph } from '../../dataflow/graph/graph';
|
|
3
3
|
import { type NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
4
4
|
import { type IdentifierDefinition } from '../../dataflow/environments/identifier';
|
|
5
|
-
type
|
|
6
|
-
type MarkEdge = `${string}->${string}`;
|
|
7
|
-
export type MermaidMarkdownMark = MarkVertex | MarkEdge;
|
|
8
|
-
export interface MermaidMarkStyle {
|
|
9
|
-
readonly vertex: string;
|
|
10
|
-
readonly edge: string;
|
|
11
|
-
}
|
|
5
|
+
import { type MermaidMarkdownMark, type MermaidMarkStyle } from './info';
|
|
12
6
|
interface MermaidGraph {
|
|
13
7
|
nodeLines: string[];
|
|
14
8
|
edgeLines: string[];
|
package/util/mermaid/dfg.js
CHANGED
|
@@ -15,6 +15,7 @@ const edge_1 = require("../../dataflow/graph/edge");
|
|
|
15
15
|
const vertex_1 = require("../../dataflow/graph/vertex");
|
|
16
16
|
const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
|
|
17
17
|
const built_in_1 = require("../../dataflow/environments/built-in");
|
|
18
|
+
const info_1 = require("./info");
|
|
18
19
|
/**
|
|
19
20
|
* Prints a {@link SourceRange|range} as a human-readable string.
|
|
20
21
|
*/
|
|
@@ -147,7 +148,7 @@ function printEnvironmentToLines(env) {
|
|
|
147
148
|
}
|
|
148
149
|
return lines;
|
|
149
150
|
}
|
|
150
|
-
function vertexToMermaid(info, mermaid, id, idPrefix, mark) {
|
|
151
|
+
function vertexToMermaid(info, mermaid, id, idPrefix, mark, includeOnlyIds) {
|
|
151
152
|
const fCall = info.tag === vertex_1.VertexType.FunctionCall;
|
|
152
153
|
const { open, close } = mermaidNodeBrackets(info.tag);
|
|
153
154
|
id = (0, mermaid_1.escapeId)(id);
|
|
@@ -184,6 +185,9 @@ function vertexToMermaid(info, mermaid, id, idPrefix, mark) {
|
|
|
184
185
|
const artificialCdEdges = (info.cds ?? []).map(x => [x.id, { types: new Set([x.when ? 'CD-True' : 'CD-False']) }]);
|
|
185
186
|
// eslint-disable-next-line prefer-const
|
|
186
187
|
for (let [target, edge] of [...edges[1], ...artificialCdEdges]) {
|
|
188
|
+
if (includeOnlyIds && !includeOnlyIds.has(target)) {
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
187
191
|
const originalTarget = target;
|
|
188
192
|
target = (0, mermaid_1.escapeId)(target);
|
|
189
193
|
const edgeTypes = typeof edge.types == 'number' ? new Set((0, edge_1.splitEdgeTypes)(edge.types)) : edge.types;
|
|
@@ -214,11 +218,11 @@ function vertexToMermaid(info, mermaid, id, idPrefix, mark) {
|
|
|
214
218
|
}
|
|
215
219
|
}
|
|
216
220
|
// make the passing of root ids more performant again
|
|
217
|
-
function graphToMermaidGraph(rootIds, { simplified, graph, prefix = 'flowchart BT', idPrefix = '', includeEnvironments = !simplified, mark, rootGraph, presentEdges = new Set(), markStyle =
|
|
221
|
+
function graphToMermaidGraph(rootIds, { simplified, graph, prefix = 'flowchart BT', idPrefix = '', includeEnvironments = !simplified, mark, rootGraph, presentEdges = new Set(), markStyle = info_1.MermaidDefaultMarkStyle, includeOnlyIds }) {
|
|
218
222
|
const mermaid = { nodeLines: prefix === null ? [] : [prefix], edgeLines: [], presentEdges, presentVertices: new Set(), mark, rootGraph: rootGraph ?? graph, includeEnvironments, markStyle, simplified };
|
|
219
223
|
for (const [id, info] of graph.vertices(true)) {
|
|
220
224
|
if (rootIds.has(id)) {
|
|
221
|
-
vertexToMermaid(info, mermaid, id, idPrefix, mark);
|
|
225
|
+
vertexToMermaid(info, mermaid, id, idPrefix, mark, includeOnlyIds);
|
|
222
226
|
}
|
|
223
227
|
}
|
|
224
228
|
return mermaid;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
2
|
+
type MarkVertex = NodeId;
|
|
3
|
+
type MarkEdge = `${string}->${string}`;
|
|
4
|
+
export type MermaidMarkdownMark = MarkVertex | MarkEdge;
|
|
5
|
+
export interface MermaidMarkStyle {
|
|
6
|
+
readonly vertex: string;
|
|
7
|
+
readonly edge: string;
|
|
8
|
+
}
|
|
9
|
+
export interface MermaidGraphPrinterInfo {
|
|
10
|
+
includeOnlyIds?: ReadonlySet<NodeId>;
|
|
11
|
+
mark?: ReadonlySet<MermaidMarkdownMark>;
|
|
12
|
+
markStyle?: MermaidMarkStyle;
|
|
13
|
+
prefix?: string;
|
|
14
|
+
simplify?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const MermaidDefaultMarkStyle: MermaidMarkStyle;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MermaidDefaultMarkStyle = void 0;
|
|
4
|
+
exports.MermaidDefaultMarkStyle = { vertex: 'stroke:teal,stroke-width:7px,stroke-opacity:.8;', edge: 'stroke:teal,stroke-width:4.2px,stroke-opacity:.8' };
|
|
5
|
+
//# sourceMappingURL=info.js.map
|
package/util/prefix.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Given a potentially partial prefix like `hell`, this finds the matching name in the keys, but only
|
|
3
3
|
* if it is unique!
|
|
4
|
+
* Please note, that `...` is considered special here, anything *afteR* `...` will not be matched by prefix but only by exact name,
|
|
5
|
+
* following R's pmatch semantics.
|
|
4
6
|
* @example
|
|
5
7
|
* ```typescript
|
|
6
|
-
* findByPrefixIfUnique('
|
|
7
|
-
* findByPrefixIfUnique('hell',
|
|
8
|
-
* findByPrefixIfUnique('
|
|
9
|
-
* findByPrefixIfUnique('',
|
|
8
|
+
* findByPrefixIfUnique('hello', [ 'hello', 'bar' ]) // => 'hello'
|
|
9
|
+
* findByPrefixIfUnique('hell', [ 'hello', 'bar' ]) // => 'hello'
|
|
10
|
+
* findByPrefixIfUnique('hell', [ 'hello', 'hell' ]) // => 'hell' (full/exact match)
|
|
11
|
+
* findByPrefixIfUnique('hell', [ 'bar', '...', 'hello' ]) // => undefined (not matched due to being after `...`)
|
|
12
|
+
* findByPrefixIfUnique('h', [ 'hello', 'hell' ]) // => undefined (not unique)
|
|
13
|
+
* findByPrefixIfUnique('', [ 'hello', 'hell' ]) // => undefined (empty prefix)
|
|
10
14
|
* ```
|
|
11
15
|
*/
|
|
12
16
|
export declare function findByPrefixIfUnique(prefix: string, keys: readonly string[] | MapIterator<string>): string | undefined;
|
package/util/prefix.js
CHANGED
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findByPrefixIfUnique = findByPrefixIfUnique;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Given a potentially partial prefix like `hell`, this finds the matching name in the keys, but only
|
|
6
6
|
* if it is unique!
|
|
7
|
+
* Please note, that `...` is considered special here, anything *afteR* `...` will not be matched by prefix but only by exact name,
|
|
8
|
+
* following R's pmatch semantics.
|
|
7
9
|
* @example
|
|
8
10
|
* ```typescript
|
|
9
|
-
* findByPrefixIfUnique('
|
|
10
|
-
* findByPrefixIfUnique('hell',
|
|
11
|
-
* findByPrefixIfUnique('
|
|
12
|
-
* findByPrefixIfUnique('',
|
|
11
|
+
* findByPrefixIfUnique('hello', [ 'hello', 'bar' ]) // => 'hello'
|
|
12
|
+
* findByPrefixIfUnique('hell', [ 'hello', 'bar' ]) // => 'hello'
|
|
13
|
+
* findByPrefixIfUnique('hell', [ 'hello', 'hell' ]) // => 'hell' (full/exact match)
|
|
14
|
+
* findByPrefixIfUnique('hell', [ 'bar', '...', 'hello' ]) // => undefined (not matched due to being after `...`)
|
|
15
|
+
* findByPrefixIfUnique('h', [ 'hello', 'hell' ]) // => undefined (not unique)
|
|
16
|
+
* findByPrefixIfUnique('', [ 'hello', 'hell' ]) // => undefined (empty prefix)
|
|
13
17
|
* ```
|
|
14
18
|
*/
|
|
15
19
|
function findByPrefixIfUnique(prefix, keys) {
|
|
@@ -17,11 +21,15 @@ function findByPrefixIfUnique(prefix, keys) {
|
|
|
17
21
|
return undefined;
|
|
18
22
|
}
|
|
19
23
|
let found = undefined;
|
|
24
|
+
let matchPartial = true;
|
|
20
25
|
for (const key of keys) {
|
|
21
26
|
if (key === prefix) {
|
|
22
27
|
return key;
|
|
23
28
|
}
|
|
24
|
-
if (key
|
|
29
|
+
if (key === '...') {
|
|
30
|
+
matchPartial = false;
|
|
31
|
+
}
|
|
32
|
+
else if (matchPartial && key.startsWith(prefix)) {
|
|
25
33
|
if (found) {
|
|
26
34
|
return undefined;
|
|
27
35
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents R's `.standard_regexps` definitions.
|
|
3
|
+
* @see https://github.com/r-devel/r-svn/blob/44474af03ae77fd3b9a340279fa10cb698d106c3/src/library/base/R/utils.R#L52-L53
|
|
4
|
+
*/
|
|
5
|
+
export declare const RStandardRegexp: {
|
|
6
|
+
/** `[[:alpha:]][[:alnum:].]*[[:alnum:]]` */
|
|
7
|
+
ValidPackageName: RegExp;
|
|
8
|
+
/** `([[:digit:]]+[.-]){1,}[[:digit:]]+` */
|
|
9
|
+
ValidPackageVersion: RegExp;
|
|
10
|
+
/** `[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+` */
|
|
11
|
+
ValidRSystemVersion: RegExp;
|
|
12
|
+
/** `([[:digit:]]+[.-])*[[:digit:]]+` */
|
|
13
|
+
ValidNumericVersion: RegExp;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Based on the C-definition:
|
|
17
|
+
* ```txt
|
|
18
|
+
* !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const RPunctuationChars = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
|
package/util/r-regex.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RPunctuationChars = exports.RStandardRegexp = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Represents R's `.standard_regexps` definitions.
|
|
6
|
+
* @see https://github.com/r-devel/r-svn/blob/44474af03ae77fd3b9a340279fa10cb698d106c3/src/library/base/R/utils.R#L52-L53
|
|
7
|
+
*/
|
|
8
|
+
exports.RStandardRegexp = {
|
|
9
|
+
/** `[[:alpha:]][[:alnum:].]*[[:alnum:]]` */
|
|
10
|
+
ValidPackageName: (/[A-Za-z][A-Za-z0-9._]*[A-Za-z0-9]/),
|
|
11
|
+
/** `([[:digit:]]+[.-]){1,}[[:digit:]]+` */
|
|
12
|
+
ValidPackageVersion: (/([0-9]+[.-])+[0-9]+/),
|
|
13
|
+
/** `[[:digit:]]+\\.[[:digit:]]+\\.[[:digit:]]+` */
|
|
14
|
+
ValidRSystemVersion: (/[0-9]+\.[0-9]+\.[0-9]+/),
|
|
15
|
+
/** `([[:digit:]]+[.-])*[[:digit:]]+` */
|
|
16
|
+
ValidNumericVersion: /([0-9]+[.-])*[0-9]+/
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Based on the C-definition:
|
|
20
|
+
* ```txt
|
|
21
|
+
* !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
exports.RPunctuationChars = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~';
|
|
25
|
+
//# sourceMappingURL=r-regex.js.map
|
package/util/text/args.js
CHANGED
|
@@ -55,10 +55,19 @@ function splitAtEscapeSensitive(inputString, escapeQuote = true, split = ' ') {
|
|
|
55
55
|
current = '';
|
|
56
56
|
}
|
|
57
57
|
else if (c === '"' || c === "'") {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
if (!inQuotes) {
|
|
59
|
+
inQuotes = c;
|
|
60
|
+
if (escapeQuote) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
61
63
|
}
|
|
64
|
+
else if (inQuotes === c) {
|
|
65
|
+
inQuotes = false;
|
|
66
|
+
if (escapeQuote) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
current += c;
|
|
62
71
|
}
|
|
63
72
|
else if (c === '\\' && escapeQuote) {
|
|
64
73
|
escaped = true;
|
package/util/version.js
CHANGED
|
@@ -6,7 +6,7 @@ exports.printVersionInformation = printVersionInformation;
|
|
|
6
6
|
const semver_1 = require("semver");
|
|
7
7
|
const assert_1 = require("./assert");
|
|
8
8
|
// this is automatically replaced with the current version by release-it
|
|
9
|
-
const version = '2.7.
|
|
9
|
+
const version = '2.7.3';
|
|
10
10
|
/**
|
|
11
11
|
* Retrieves the current flowR version as a new {@link SemVer} object.
|
|
12
12
|
*/
|