@eagleoutice/flowr 2.9.13 → 2.9.14
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 +22 -10
- package/abstract-interpretation/absint-visitor.d.ts +1 -1
- package/abstract-interpretation/absint-visitor.js +20 -20
- package/abstract-interpretation/data-frame/mappers/replacement-mapper.js +2 -2
- package/benchmark/slicer.d.ts +1 -1
- package/benchmark/slicer.js +7 -5
- package/cli/repl/commands/repl-dataflow.js +5 -5
- package/cli/repl/parser/slice-query-parser.d.ts +1 -1
- package/cli/repl/parser/slice-query-parser.js +2 -2
- package/cli/repl/server/connection.js +2 -2
- package/cli/repl/server/messages/message-slice.d.ts +1 -1
- package/cli/repl/server/messages/message-slice.js +2 -2
- package/config.d.ts +8 -8
- package/control-flow/extract-cfg.js +2 -2
- package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +43 -43
- package/control-flow/useless-loop.d.ts +1 -1
- package/control-flow/useless-loop.js +3 -3
- package/core/print/dataflow-printer.d.ts +0 -14
- package/core/print/dataflow-printer.js +0 -21
- package/core/steps/all/core/20-dataflow.d.ts +3 -3
- package/core/steps/all/core/20-dataflow.js +3 -2
- package/core/steps/all/static-slicing/00-slice.d.ts +2 -5
- package/core/steps/all/static-slicing/00-slice.js +6 -8
- package/core/steps/pipeline/default-pipelines.d.ts +89 -89
- package/dataflow/environments/built-in-proc-name.d.ts +83 -0
- package/dataflow/environments/built-in-proc-name.js +88 -0
- package/dataflow/environments/built-in.d.ts +1 -83
- package/dataflow/environments/built-in.js +37 -120
- package/dataflow/environments/default-builtin-config.d.ts +1 -1
- package/dataflow/environments/default-builtin-config.js +75 -75
- package/dataflow/environments/identifier.d.ts +1 -0
- package/dataflow/environments/identifier.js +1 -0
- package/dataflow/eval/resolve/resolve.js +2 -2
- package/dataflow/fn/exceptions-of-function.d.ts +1 -1
- package/dataflow/fn/exceptions-of-function.js +2 -2
- package/dataflow/graph/call-graph.d.ts +49 -19
- package/dataflow/graph/call-graph.js +117 -114
- package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
- package/dataflow/graph/dataflowgraph-builder.js +2 -2
- package/dataflow/graph/df-helper.d.ts +132 -0
- package/dataflow/graph/df-helper.js +131 -0
- package/dataflow/graph/diff-dataflow-graph.d.ts +5 -10
- package/dataflow/graph/diff-dataflow-graph.js +3 -28
- package/dataflow/graph/edge.d.ts +1 -0
- package/dataflow/graph/edge.js +1 -0
- package/dataflow/graph/graph-helper.d.ts +55 -0
- package/dataflow/graph/graph-helper.js +105 -0
- package/dataflow/graph/graph.d.ts +6 -1
- package/dataflow/graph/graph.js +6 -1
- package/dataflow/graph/vertex.d.ts +1 -1
- package/dataflow/info.d.ts +14 -4
- package/dataflow/info.js +28 -16
- package/dataflow/internal/linker.d.ts +14 -10
- package/dataflow/internal/linker.js +29 -32
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +7 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-local.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +7 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +6 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +2 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +2 -2
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +1 -1
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +2 -2
- package/dataflow/internal/process/process-uninteresting-leaf.d.ts +1 -1
- package/dataflow/internal/process/process-uninteresting-leaf.js +1 -1
- package/dataflow/origin/dfg-get-origin.d.ts +1 -1
- package/dataflow/origin/dfg-get-symbol-refs.js +6 -6
- package/documentation/doc-util/doc-dfg.d.ts +3 -0
- package/documentation/doc-util/doc-dfg.js +5 -7
- package/documentation/doc-util/doc-normalized-ast.d.ts +0 -6
- package/documentation/doc-util/doc-normalized-ast.js +0 -23
- package/documentation/doc-util/doc-structure.js +3 -3
- package/documentation/doc-util/doc-types.js +3 -3
- package/documentation/wiki-core.js +5 -4
- package/documentation/wiki-dataflow-graph.js +14 -12
- package/documentation/wiki-interface.js +3 -3
- package/documentation/wiki-linter.js +1 -0
- package/documentation/wiki-normalized-ast.js +5 -4
- package/documentation/wiki-query.js +28 -3
- package/linter/linter-rules.d.ts +24 -1
- package/linter/linter-rules.js +3 -1
- package/linter/rules/seeded-randomness.js +2 -2
- package/linter/rules/stop-with-call-arg.d.ts +35 -0
- package/linter/rules/stop-with-call-arg.js +72 -0
- package/linter/rules/useless-loop.d.ts +1 -1
- package/package.json +1 -1
- package/project/cache/flowr-analyzer-cache.d.ts +1 -1
- package/project/cache/flowr-analyzer-cache.js +1 -1
- package/project/flowr-analyzer-builder.d.ts +3 -0
- package/project/flowr-analyzer.d.ts +1 -1
- package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +2 -2
- package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +1 -1
- package/queries/catalog/call-graph-query/call-graph-query-format.js +2 -2
- package/queries/catalog/cluster-query/cluster-query-format.js +2 -2
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -2
- package/queries/catalog/df-shape-query/df-shape-query-executor.js +1 -2
- package/queries/catalog/does-call-query/does-call-query-executor.js +2 -2
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +1 -1
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +1 -1
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -3
- package/queries/catalog/location-map-query/location-map-query-executor.js +2 -2
- package/queries/catalog/origin-query/origin-query-executor.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-executor.js +3 -3
- package/queries/catalog/provenance-query/provenance-query-executor.d.ts +9 -0
- package/queries/catalog/provenance-query/provenance-query-executor.js +37 -0
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +35 -0
- package/queries/catalog/provenance-query/provenance-query-format.js +62 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +2 -2
- package/queries/catalog/search-query/search-query-format.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -3
- package/queries/query.d.ts +9 -1
- package/queries/query.js +2 -0
- package/r-bridge/lang-4.x/ast/model/model.d.ts +6 -0
- package/r-bridge/lang-4.x/ast/model/model.js +7 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +8 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +13 -0
- package/search/flowr-search-filters.d.ts +1 -1
- package/search/flowr-search-printer.js +3 -3
- package/search/search-executor/search-enrichers.js +2 -2
- package/search/search-executor/search-generators.js +1 -1
- package/slicing/criterion/parse.d.ts +40 -16
- package/slicing/criterion/parse.js +67 -63
- package/slicing/static/slicer-types.d.ts +2 -3
- package/slicing/static/static-slicer.d.ts +3 -4
- package/slicing/static/static-slicer.js +9 -12
- package/util/diff.d.ts +2 -2
- package/util/mermaid/ast.js +4 -4
- package/util/mermaid/cfg.js +5 -5
- package/util/mermaid/dfg.d.ts +33 -18
- package/util/mermaid/dfg.js +46 -31
- package/util/mermaid/mermaid.d.ts +57 -12
- package/util/mermaid/mermaid.js +74 -67
- package/util/range.d.ts +8 -0
- package/util/range.js +13 -1
- package/util/slice-direction.d.ts +7 -0
- package/util/slice-direction.js +12 -0
- package/util/version.js +1 -1
- package/dataflow/graph/invert-dfg.d.ts +0 -6
- package/dataflow/graph/invert-dfg.js +0 -20
- package/dataflow/graph/resolve-graph.d.ts +0 -8
- package/dataflow/graph/resolve-graph.js +0 -59
package/util/mermaid/dfg.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataflowMermaid = void 0;
|
|
3
4
|
exports.mermaidNodeBrackets = mermaidNodeBrackets;
|
|
4
5
|
exports.printIdentifier = printIdentifier;
|
|
5
|
-
exports.graphToMermaid = graphToMermaid;
|
|
6
|
-
exports.graphToMermaidUrl = graphToMermaidUrl;
|
|
7
6
|
exports.diffGraphsToMermaid = diffGraphsToMermaid;
|
|
8
7
|
exports.diffGraphsToMermaidUrl = diffGraphsToMermaidUrl;
|
|
9
8
|
const mermaid_1 = require("./mermaid");
|
|
@@ -17,18 +16,19 @@ const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
|
|
|
17
16
|
const info_1 = require("./info");
|
|
18
17
|
const range_1 = require("../range");
|
|
19
18
|
const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
|
|
19
|
+
const info_2 = require("../../dataflow/info");
|
|
20
20
|
function subflowToMermaid(nodeId, subflow, mermaid, idPrefix = '') {
|
|
21
21
|
if (subflow === undefined) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
const subflowId =
|
|
24
|
+
const subflowId = mermaid_1.Mermaid.escapeId(`${idPrefix}flow-${nodeId}`);
|
|
25
25
|
if (mermaid.simplified) {
|
|
26
26
|
// get parent
|
|
27
27
|
const idMap = mermaid.rootGraph.idMap;
|
|
28
28
|
const node = idMap?.get(nodeId);
|
|
29
29
|
const nodeLexeme = model_1.RNode.lexeme(node) ?? 'function';
|
|
30
30
|
const location = node?.location?.[0] ? ` (L. ${node?.location?.[0]})` : '';
|
|
31
|
-
mermaid.nodeLines.push(`\nsubgraph "${subflowId}" ["${
|
|
31
|
+
mermaid.nodeLines.push(`\nsubgraph "${subflowId}" ["${mermaid_1.Mermaid.escape(nodeLexeme)}${location}"]`);
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
34
|
mermaid.nodeLines.push(`\nsubgraph "${subflowId}" [function ${nodeId}]`);
|
|
@@ -83,7 +83,7 @@ function printArg(arg) {
|
|
|
83
83
|
function displayFunctionArgMapping(argMapping) {
|
|
84
84
|
const result = [];
|
|
85
85
|
for (const arg of argMapping) {
|
|
86
|
-
result.push(
|
|
86
|
+
result.push(mermaid_1.Mermaid.escape(printArg(arg)));
|
|
87
87
|
}
|
|
88
88
|
return result.length === 0 ? '' : `\n (${result.join(', ')})`;
|
|
89
89
|
}
|
|
@@ -139,7 +139,7 @@ function vertexToMermaid(info, mermaid, id, idPrefix, mark, includeOnlyIds) {
|
|
|
139
139
|
const fCall = info.tag === vertex_1.VertexType.FunctionCall;
|
|
140
140
|
const { open, close } = mermaidNodeBrackets(info.tag);
|
|
141
141
|
const origId = id;
|
|
142
|
-
id =
|
|
142
|
+
id = mermaid_1.Mermaid.escapeId(id);
|
|
143
143
|
if (info.environment && mermaid.includeEnvironments) {
|
|
144
144
|
if (info.environment.level > 0 || info.environment.current.memory.size !== 0) {
|
|
145
145
|
mermaid.nodeLines.push(` %% Environment of ${id} [level: ${info.environment.level}]:`, printEnvironmentToLines(info.environment.current).map(x => ` %% ${x}`).join('\n'));
|
|
@@ -149,15 +149,15 @@ function vertexToMermaid(info, mermaid, id, idPrefix, mark, includeOnlyIds) {
|
|
|
149
149
|
const lexeme = node?.lexeme ?? (node?.type === type_1.RType.ExpressionList ? node?.grouping?.[0]?.lexeme : '') ?? '??';
|
|
150
150
|
if (mermaid.simplified) {
|
|
151
151
|
const location = node?.location?.[0] ? ` (L. ${node?.location?.[0]})` : '';
|
|
152
|
-
const escapedName = '**' +
|
|
152
|
+
const escapedName = '**' + mermaid_1.Mermaid.escape(node ? `${lexeme}` : '??') + '**' + location + (node ? `\n*${node.type}*` : '');
|
|
153
153
|
mermaid.nodeLines.push(` ${idPrefix}${id}${open}"\`${escapedName}\`"${close}`);
|
|
154
154
|
}
|
|
155
155
|
else {
|
|
156
|
-
const escapedName =
|
|
156
|
+
const escapedName = mermaid_1.Mermaid.escape(node ? `[${node.type}] ${lexeme}` : '??');
|
|
157
157
|
const deps = info.cds ? ', :may:' + info.cds.map(c => c.id + (c.when ? '+' : '-')).join(',') : '';
|
|
158
158
|
const lnks = info.link?.origin ? ', :links:' + info.link.origin.join(',') : '';
|
|
159
159
|
const n = node?.info.fullRange ?? node?.location ?? (node?.type === type_1.RType.ExpressionList ? node?.grouping?.[0].location : undefined);
|
|
160
|
-
mermaid.nodeLines.push(` ${idPrefix}${id}${open}"\`${escapedName}${escapedName.length > 10 ? '\n ' : ' '}(${id}${deps}${lnks})\n *${range_1.SourceRange.format(n)}*${fCall ? displayFunctionArgMapping(info.args) : '' + (info.tag === vertex_1.VertexType.FunctionDefinition && info.mode && info.mode.length > 0 ?
|
|
160
|
+
mermaid.nodeLines.push(` ${idPrefix}${id}${open}"\`${escapedName}${escapedName.length > 10 ? '\n ' : ' '}(${id}${deps}${lnks})\n *${range_1.SourceRange.format(n)}*${fCall ? displayFunctionArgMapping(info.args) : '' + (info.tag === vertex_1.VertexType.FunctionDefinition && info.mode && info.mode.length > 0 ? mermaid_1.Mermaid.escape(JSON.stringify(info.mode)) : '')}\`"${close}`);
|
|
161
161
|
}
|
|
162
162
|
if (mark?.has(id)) {
|
|
163
163
|
mermaid.nodeLines.push(` style ${idPrefix}${id} ${mermaid.markStyle.vertex} `);
|
|
@@ -180,7 +180,7 @@ function vertexToMermaid(info, mermaid, id, idPrefix, mark, includeOnlyIds) {
|
|
|
180
180
|
continue;
|
|
181
181
|
}
|
|
182
182
|
const originalTarget = target;
|
|
183
|
-
target =
|
|
183
|
+
target = mermaid_1.Mermaid.escapeId(target);
|
|
184
184
|
const edgeTypes = typeof edge.types == 'number' ? new Set(edge_1.DfEdge.splitTypes(edge)) : edge.types;
|
|
185
185
|
const edgeId = encodeEdge(idPrefix + id, idPrefix + target, edgeTypes);
|
|
186
186
|
if (!mermaid.presentEdges.has(edgeId)) {
|
|
@@ -197,7 +197,7 @@ function vertexToMermaid(info, mermaid, id, idPrefix, mark, includeOnlyIds) {
|
|
|
197
197
|
if (node_id_1.NodeId.isBuiltIn(target)) {
|
|
198
198
|
mermaid.edgeLines.push(` linkStyle ${mermaid.presentEdges.size - 1} stroke:gray;`);
|
|
199
199
|
if (!mermaid.presentVertices.has(target)) {
|
|
200
|
-
mermaid.nodeLines.push(` ${idPrefix}${target}["\`Built-In:\n${
|
|
200
|
+
mermaid.nodeLines.push(` ${idPrefix}${target}["\`Built-In:\n${mermaid_1.Mermaid.escape(String(originalTarget).replace('built-in:', ''))}\`"]`);
|
|
201
201
|
mermaid.nodeLines.push(` style ${idPrefix}${target} stroke:gray,fill:gray,stroke-width:2px,opacity:.8;`);
|
|
202
202
|
mermaid.presentVertices.add(target);
|
|
203
203
|
}
|
|
@@ -215,34 +215,49 @@ function graphToMermaidGraph(rootIds, { simplified, graph, prefix = 'flowchart B
|
|
|
215
215
|
}
|
|
216
216
|
return mermaid;
|
|
217
217
|
}
|
|
218
|
-
/**
|
|
219
|
-
* Converts a dataflow graph to mermaid graph code that visualizes the graph.
|
|
220
|
-
*/
|
|
221
|
-
function graphToMermaid(config) {
|
|
222
|
-
const mermaid = graphToMermaidGraph(config.includeOnlyIds ? config.includeOnlyIds : config.graph.rootIds(), config);
|
|
223
|
-
return { string: `${mermaid.nodeLines.join('\n')}\n${mermaid.edgeLines.join('\n')}`, mermaid };
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Converts a dataflow graph to a mermaid url that visualizes the graph.
|
|
227
|
-
* @param graph - The graph to convert
|
|
228
|
-
* @param includeEnvironments - Whether to include the environments in the mermaid graph code
|
|
229
|
-
* @param mark - Special nodes to mark (e.g., those included in the slice)
|
|
230
|
-
* @param simplified - Whether to simplify the graph
|
|
231
|
-
*/
|
|
232
|
-
function graphToMermaidUrl(graph, includeEnvironments, mark, simplified = false) {
|
|
233
|
-
return (0, mermaid_1.mermaidCodeToUrl)(graphToMermaid({ graph, includeEnvironments, mark, simplified }).string);
|
|
234
|
-
}
|
|
235
218
|
/** uses same id map but ensures, it is different from the rhs so that mermaid can work with that */
|
|
236
219
|
function diffGraphsToMermaid(left, right, prefix) {
|
|
237
220
|
// we add the prefix ourselves
|
|
238
|
-
const { string: leftGraph, mermaid } =
|
|
239
|
-
const { string: rightGraph } =
|
|
221
|
+
const { string: leftGraph, mermaid } = exports.DataflowMermaid.convert({ graph: left.graph, prefix: '', idPrefix: `l-${left.label}`, includeEnvironments: true, mark: left.mark });
|
|
222
|
+
const { string: rightGraph } = exports.DataflowMermaid.convert({ graph: right.graph, prefix: '', idPrefix: `r-${right.label}`, includeEnvironments: true, mark: right.mark, presentEdges: mermaid.presentEdges });
|
|
240
223
|
return `${prefix}flowchart BT\nsubgraph "${left.label}"\n${leftGraph}\nend\nsubgraph "${right.label}"\n${rightGraph}\nend`;
|
|
241
224
|
}
|
|
242
225
|
/**
|
|
243
226
|
* Converts two dataflow graphs to a mermaid url that visualizes their differences.
|
|
244
227
|
*/
|
|
245
228
|
function diffGraphsToMermaidUrl(left, right, prefix) {
|
|
246
|
-
return
|
|
229
|
+
return mermaid_1.Mermaid.codeToUrl(diffGraphsToMermaid(left, right, prefix));
|
|
247
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* The helper object for all things regarding the mermaid based visualization of dataflow graphs!
|
|
233
|
+
*/
|
|
234
|
+
exports.DataflowMermaid = {
|
|
235
|
+
name: 'DataflowMermaid',
|
|
236
|
+
/**
|
|
237
|
+
* Converts a dataflow graph to mermaid graph code that visualizes the graph.
|
|
238
|
+
* @see {@link DataflowMermaid.url} - render the given graph to a url to mermaid.live
|
|
239
|
+
*/
|
|
240
|
+
convert(config) {
|
|
241
|
+
const mermaid = graphToMermaidGraph(config.includeOnlyIds ?? config.graph.rootIds(), config);
|
|
242
|
+
return { string: `${mermaid.nodeLines.join('\n')}\n${mermaid.edgeLines.join('\n')}`, mermaid };
|
|
243
|
+
},
|
|
244
|
+
/**
|
|
245
|
+
* This is a simplified version of {@link DataflowMermaid.convertToMermaid}
|
|
246
|
+
*/
|
|
247
|
+
raw(graph, includeEnvironments, mark, simplified = false) {
|
|
248
|
+
graph = info_2.DataflowInformation.is(graph) ? graph.graph : graph;
|
|
249
|
+
return exports.DataflowMermaid.convert({ graph, includeEnvironments, mark, simplified }).string;
|
|
250
|
+
},
|
|
251
|
+
/**
|
|
252
|
+
* Converts a dataflow graph to a mermaid url that visualizes the graph.
|
|
253
|
+
* This is basically a combination of {@link DataflowMermaid.mermaidRaw} and {@link Mermaid.codeToUrl}.
|
|
254
|
+
* @param graph - the dataflow graph to render
|
|
255
|
+
* @param includeEnvironments - whether to include the environment content in the output
|
|
256
|
+
* @param mark - which vertices to highlight in the visualization
|
|
257
|
+
* @param simplified - whether to show a simplified use of the graph with fewer details on the vertices and edges
|
|
258
|
+
*/
|
|
259
|
+
url(graph, includeEnvironments, mark, simplified = false) {
|
|
260
|
+
return mermaid_1.Mermaid.codeToUrl(exports.DataflowMermaid.raw(graph, includeEnvironments, mark, simplified));
|
|
261
|
+
}
|
|
262
|
+
};
|
|
248
263
|
//# sourceMappingURL=dfg.js.map
|
|
@@ -1,14 +1,59 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Global mermaid helper object with useful functions.
|
|
3
3
|
*/
|
|
4
|
-
export declare
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
export declare const Mermaid: {
|
|
5
|
+
readonly name: "Mermaid";
|
|
6
|
+
/**
|
|
7
|
+
* Replacements applied by escape functions!
|
|
8
|
+
*/
|
|
9
|
+
readonly replacements: {
|
|
10
|
+
readonly '\\n': "\n";
|
|
11
|
+
readonly '`': "#96;";
|
|
12
|
+
readonly '[': "#91;";
|
|
13
|
+
readonly ']': "#93;";
|
|
14
|
+
readonly '<': "#60;";
|
|
15
|
+
readonly '>': "#62;";
|
|
16
|
+
readonly '*': "#42;";
|
|
17
|
+
readonly '+': "#43;";
|
|
18
|
+
readonly '-': "#45;";
|
|
19
|
+
readonly '"': "#34;";
|
|
20
|
+
readonly '\\': "#92;";
|
|
21
|
+
readonly _: "#95;";
|
|
22
|
+
readonly '{': "#123;";
|
|
23
|
+
readonly '}': "#125;";
|
|
24
|
+
readonly '&': "#38;";
|
|
25
|
+
readonly '\'': "#39;";
|
|
26
|
+
readonly ':': "#58;";
|
|
27
|
+
readonly '\u2228': "#8744;";
|
|
28
|
+
readonly '\u2227': "#8743;";
|
|
29
|
+
readonly '\u00AC': "#172;";
|
|
30
|
+
readonly '\u2192': "#8594;";
|
|
31
|
+
readonly '\u2194': "#8596;";
|
|
32
|
+
readonly '\u21D2': "#8658;";
|
|
33
|
+
readonly '\u21D4': "#8660;";
|
|
34
|
+
readonly '\u2200': "#8704;";
|
|
35
|
+
readonly '\u2203': "#8707;";
|
|
36
|
+
readonly '\u2208': "#8712;";
|
|
37
|
+
readonly '\u2209': "#8713;";
|
|
38
|
+
readonly '\u220B': "#8715;";
|
|
39
|
+
readonly '\u220C': "#8716;";
|
|
40
|
+
readonly '\u2229': "#8745;";
|
|
41
|
+
readonly '\u222A': "#8746;";
|
|
42
|
+
readonly '\u222B': "#8747;";
|
|
43
|
+
readonly '\u2295': "#8853;";
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Escapes markdown special characters in a string.
|
|
47
|
+
*/
|
|
48
|
+
readonly escape: (this: void, text: string) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Escapes a string or number to be used as a mermaid node id.
|
|
51
|
+
*/
|
|
52
|
+
readonly escapeId: (this: void, text: string | number) => string;
|
|
53
|
+
/**
|
|
54
|
+
* Converts mermaid code (potentially produced by {@link DataflowMermaid.convert}) to an url that presents the graph in the mermaid editor.
|
|
55
|
+
* @param code - code to convert
|
|
56
|
+
* @param edit - if true, the url will point to the editor, otherwise it will point to the viewer
|
|
57
|
+
*/
|
|
58
|
+
readonly codeToUrl: (this: void, code: string, edit?: boolean) => string;
|
|
59
|
+
};
|
package/util/mermaid/mermaid.js
CHANGED
|
@@ -1,73 +1,80 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.escapeId = escapeId;
|
|
5
|
-
exports.mermaidCodeToUrl = mermaidCodeToUrl;
|
|
6
|
-
const replacements = {
|
|
7
|
-
// keep newlines
|
|
8
|
-
'\\n': '\n',
|
|
9
|
-
'`': '#96;',
|
|
10
|
-
'[': '#91;',
|
|
11
|
-
']': '#93;',
|
|
12
|
-
'<': '#60;',
|
|
13
|
-
'>': '#62;',
|
|
14
|
-
'*': '#42;',
|
|
15
|
-
'+': '#43;',
|
|
16
|
-
'-': '#45;',
|
|
17
|
-
'"': '#34;',
|
|
18
|
-
'\\': '#92;',
|
|
19
|
-
'_': '#95;',
|
|
20
|
-
'{': '#123;',
|
|
21
|
-
'}': '#125;',
|
|
22
|
-
'&': '#38;',
|
|
23
|
-
'\'': '#39;',
|
|
24
|
-
':': '#58;',
|
|
25
|
-
'∨': '#8744;',
|
|
26
|
-
'∧': '#8743;',
|
|
27
|
-
'¬': '#172;',
|
|
28
|
-
'→': '#8594;',
|
|
29
|
-
'↔': '#8596;',
|
|
30
|
-
'⇒': '#8658;',
|
|
31
|
-
'⇔': '#8660;',
|
|
32
|
-
'∀': '#8704;',
|
|
33
|
-
'∃': '#8707;',
|
|
34
|
-
'∈': '#8712;',
|
|
35
|
-
'∉': '#8713;',
|
|
36
|
-
'∋': '#8715;',
|
|
37
|
-
'∌': '#8716;',
|
|
38
|
-
'∩': '#8745;',
|
|
39
|
-
'∪': '#8746;',
|
|
40
|
-
'∫': '#8747;',
|
|
41
|
-
'⊕': '#8853;',
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Escapes markdown special characters in a string.
|
|
45
|
-
*/
|
|
46
|
-
function escapeMarkdown(text) {
|
|
47
|
-
for (const [key, value] of Object.entries(replacements)) {
|
|
48
|
-
text = text.replaceAll(key, value);
|
|
49
|
-
}
|
|
50
|
-
return text;
|
|
51
|
-
}
|
|
3
|
+
exports.Mermaid = void 0;
|
|
52
4
|
/**
|
|
53
|
-
*
|
|
5
|
+
* Global mermaid helper object with useful functions.
|
|
54
6
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
7
|
+
exports.Mermaid = {
|
|
8
|
+
name: 'Mermaid',
|
|
9
|
+
/**
|
|
10
|
+
* Replacements applied by escape functions!
|
|
11
|
+
*/
|
|
12
|
+
replacements: {
|
|
13
|
+
// keep newlines
|
|
14
|
+
'\\n': '\n',
|
|
15
|
+
'`': '#96;',
|
|
16
|
+
'[': '#91;',
|
|
17
|
+
']': '#93;',
|
|
18
|
+
'<': '#60;',
|
|
19
|
+
'>': '#62;',
|
|
20
|
+
'*': '#42;',
|
|
21
|
+
'+': '#43;',
|
|
22
|
+
'-': '#45;',
|
|
23
|
+
'"': '#34;',
|
|
24
|
+
'\\': '#92;',
|
|
25
|
+
'_': '#95;',
|
|
26
|
+
'{': '#123;',
|
|
27
|
+
'}': '#125;',
|
|
28
|
+
'&': '#38;',
|
|
29
|
+
'\'': '#39;',
|
|
30
|
+
':': '#58;',
|
|
31
|
+
'∨': '#8744;',
|
|
32
|
+
'∧': '#8743;',
|
|
33
|
+
'¬': '#172;',
|
|
34
|
+
'→': '#8594;',
|
|
35
|
+
'↔': '#8596;',
|
|
36
|
+
'⇒': '#8658;',
|
|
37
|
+
'⇔': '#8660;',
|
|
38
|
+
'∀': '#8704;',
|
|
39
|
+
'∃': '#8707;',
|
|
40
|
+
'∈': '#8712;',
|
|
41
|
+
'∉': '#8713;',
|
|
42
|
+
'∋': '#8715;',
|
|
43
|
+
'∌': '#8716;',
|
|
44
|
+
'∩': '#8745;',
|
|
45
|
+
'∪': '#8746;',
|
|
46
|
+
'∫': '#8747;',
|
|
47
|
+
'⊕': '#8853;',
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Escapes markdown special characters in a string.
|
|
51
|
+
*/
|
|
52
|
+
escape(text) {
|
|
53
|
+
for (const [key, value] of Object.entries(exports.Mermaid.replacements)) {
|
|
54
|
+
text = text.replaceAll(key, value);
|
|
69
55
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
56
|
+
return text;
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* Escapes a string or number to be used as a mermaid node id.
|
|
60
|
+
*/
|
|
61
|
+
escapeId(text) {
|
|
62
|
+
text = String(text).replace(/[^a-zA-Z0-9:-]/g, '_');
|
|
63
|
+
return text;
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* Converts mermaid code (potentially produced by {@link DataflowMermaid.convert}) to an url that presents the graph in the mermaid editor.
|
|
67
|
+
* @param code - code to convert
|
|
68
|
+
* @param edit - if true, the url will point to the editor, otherwise it will point to the viewer
|
|
69
|
+
*/
|
|
70
|
+
codeToUrl(code, edit = false) {
|
|
71
|
+
const obj = {
|
|
72
|
+
code,
|
|
73
|
+
mermaid: {
|
|
74
|
+
autoSync: true
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
return `https://mermaid.live/${edit ? 'edit' : 'view'}#base64:${Buffer.from(JSON.stringify(obj)).toString('base64')}`;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
73
80
|
//# sourceMappingURL=mermaid.js.map
|
package/util/range.d.ts
CHANGED
|
@@ -31,6 +31,14 @@ export declare const SourcePosition: {
|
|
|
31
31
|
* returns an invalid source position
|
|
32
32
|
*/
|
|
33
33
|
readonly invalid: (this: void) => SourcePosition;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the line of a source position
|
|
36
|
+
*/
|
|
37
|
+
readonly getLine: (this: void, pos: SourcePosition) => number;
|
|
38
|
+
/**
|
|
39
|
+
* Returns the column of a source position
|
|
40
|
+
*/
|
|
41
|
+
readonly getColumn: (this: void, pos: SourcePosition) => number;
|
|
34
42
|
};
|
|
35
43
|
/**
|
|
36
44
|
* **Please note** that for multi-file projects we also have a {@link SourceLocation|source location} type that includes the file name.
|
package/util/range.js
CHANGED
|
@@ -31,7 +31,19 @@ exports.SourcePosition = {
|
|
|
31
31
|
*/
|
|
32
32
|
invalid() {
|
|
33
33
|
return [-1, -1];
|
|
34
|
-
}
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* Returns the line of a source position
|
|
37
|
+
*/
|
|
38
|
+
getLine(pos) {
|
|
39
|
+
return pos[0];
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* Returns the column of a source position
|
|
43
|
+
*/
|
|
44
|
+
getColumn(pos) {
|
|
45
|
+
return pos[1];
|
|
46
|
+
},
|
|
35
47
|
};
|
|
36
48
|
/**
|
|
37
49
|
* Utility functions for {@link SourceRange|source ranges}.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SliceDirection = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The direction to slice a program.
|
|
6
|
+
*/
|
|
7
|
+
var SliceDirection;
|
|
8
|
+
(function (SliceDirection) {
|
|
9
|
+
SliceDirection["Backward"] = "backward";
|
|
10
|
+
SliceDirection["Forward"] = "forward";
|
|
11
|
+
})(SliceDirection || (exports.SliceDirection = SliceDirection = {}));
|
|
12
|
+
//# sourceMappingURL=slice-direction.js.map
|
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.9.
|
|
9
|
+
const version = '2.9.14';
|
|
10
10
|
/**
|
|
11
11
|
* Retrieves the current flowR version as a new {@link SemVer} object.
|
|
12
12
|
*/
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { DataflowGraph } from './graph';
|
|
2
|
-
import type { REnvironmentInformation } from '../environments/environment';
|
|
3
|
-
/**
|
|
4
|
-
* Inverts the given dataflow graph by reversing all edges.
|
|
5
|
-
*/
|
|
6
|
-
export declare function invertDfg(graph: DataflowGraph, cleanEnv: REnvironmentInformation): DataflowGraph;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.invertDfg = invertDfg;
|
|
4
|
-
const graph_1 = require("./graph");
|
|
5
|
-
/**
|
|
6
|
-
* Inverts the given dataflow graph by reversing all edges.
|
|
7
|
-
*/
|
|
8
|
-
function invertDfg(graph, cleanEnv) {
|
|
9
|
-
const invertedGraph = new graph_1.DataflowGraph(graph.idMap);
|
|
10
|
-
for (const [, v] of graph.vertices(true)) {
|
|
11
|
-
invertedGraph.addVertex(v, cleanEnv);
|
|
12
|
-
}
|
|
13
|
-
for (const [from, targets] of graph.edges()) {
|
|
14
|
-
for (const [to, { types }] of targets) {
|
|
15
|
-
invertedGraph.addEdge(to, from, types);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return invertedGraph;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=invert-dfg.js.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { DataflowGraph } from './graph';
|
|
2
|
-
import { type AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
3
|
-
import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
|
|
4
|
-
/**
|
|
5
|
-
* Resolves the dataflow graph ids from slicing criterion form to ids.
|
|
6
|
-
* This returns a **new** graph with the resolved ids.
|
|
7
|
-
*/
|
|
8
|
-
export declare function resolveDataflowGraph(graph: DataflowGraph, ctx: ReadOnlyFlowrAnalyzerContext, idMap?: AstIdMap): DataflowGraph;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveDataflowGraph = resolveDataflowGraph;
|
|
4
|
-
const graph_1 = require("./graph");
|
|
5
|
-
const assert_1 = require("../../util/assert");
|
|
6
|
-
const parse_1 = require("../../slicing/criterion/parse");
|
|
7
|
-
const edge_1 = require("./edge");
|
|
8
|
-
/**
|
|
9
|
-
* Resolves the dataflow graph ids from slicing criterion form to ids.
|
|
10
|
-
* This returns a **new** graph with the resolved ids.
|
|
11
|
-
*/
|
|
12
|
-
function resolveDataflowGraph(graph, ctx, idMap) {
|
|
13
|
-
const resolveMap = idMap ?? graph.idMap;
|
|
14
|
-
(0, assert_1.guard)(resolveMap !== undefined, 'idMap must be provided to resolve the graph');
|
|
15
|
-
const cache = new Map();
|
|
16
|
-
const resolve = (id) => {
|
|
17
|
-
const cached = cache.get(id);
|
|
18
|
-
if (cached !== undefined) {
|
|
19
|
-
return cached;
|
|
20
|
-
}
|
|
21
|
-
let resolved;
|
|
22
|
-
try {
|
|
23
|
-
resolved = (0, parse_1.slicingCriterionToId)(id, resolveMap);
|
|
24
|
-
}
|
|
25
|
-
catch {
|
|
26
|
-
/* just keep it :D */
|
|
27
|
-
resolved = id;
|
|
28
|
-
}
|
|
29
|
-
cache.set(id, resolved);
|
|
30
|
-
return resolved;
|
|
31
|
-
};
|
|
32
|
-
const resultGraph = new graph_1.DataflowGraph(resolveMap);
|
|
33
|
-
const roots = graph.rootIds();
|
|
34
|
-
/* recreate vertices */
|
|
35
|
-
for (const [id, vertex] of graph.vertices(true)) {
|
|
36
|
-
resultGraph.addVertex({
|
|
37
|
-
...vertex,
|
|
38
|
-
id: resolve(id)
|
|
39
|
-
}, ctx.env.makeCleanEnv(), roots.has(id));
|
|
40
|
-
}
|
|
41
|
-
/* recreate edges */
|
|
42
|
-
for (const [from, targets] of graph.edges()) {
|
|
43
|
-
for (const [to, info] of targets) {
|
|
44
|
-
for (const type of edge_1.DfEdge.splitTypes(info)) {
|
|
45
|
-
resultGraph.addEdge(resolve(from), resolve(to), type);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
for (const unknown of graph.unknownSideEffects) {
|
|
50
|
-
if (typeof unknown === 'object') {
|
|
51
|
-
resultGraph.markIdForUnknownSideEffects(resolve(unknown.id), unknown.linkTo);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
resultGraph.markIdForUnknownSideEffects(resolve(unknown));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return resultGraph;
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=resolve-graph.js.map
|