@eagleoutice/flowr 2.2.2 → 2.2.4

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 (116) hide show
  1. package/README.md +412 -39
  2. package/benchmark/slicer.js +0 -1
  3. package/benchmark/summarizer/first-phase/process.js +18 -8
  4. package/benchmark/summarizer/summarizer.d.ts +1 -1
  5. package/benchmark/summarizer/summarizer.js +1 -1
  6. package/cli/benchmark-app.js +1 -1
  7. package/cli/common/script.js +0 -1
  8. package/cli/repl/commands/repl-cfg.js +38 -8
  9. package/cli/repl/commands/repl-commands.js +1 -1
  10. package/cli/repl/commands/repl-dataflow.js +45 -12
  11. package/cli/repl/commands/repl-normalize.js +38 -8
  12. package/cli/repl/commands/repl-parse.js +43 -2
  13. package/cli/repl/commands/repl-query.js +2 -2
  14. package/cli/repl/core.js +17 -8
  15. package/cli/repl/print-version.d.ts +1 -0
  16. package/cli/repl/print-version.js +8 -2
  17. package/cli/repl/server/connection.js +27 -15
  18. package/cli/repl/server/messages/all-messages.js +17 -7
  19. package/cli/repl/server/messages/message-repl.js +17 -7
  20. package/cli/repl/server/messages/message-slice.js +17 -7
  21. package/cli/script-core/statistics-helper-core.js +0 -1
  22. package/core/pipeline-executor.d.ts +6 -0
  23. package/core/pipeline-executor.js +8 -0
  24. package/core/print/dataflow-printer.js +3 -0
  25. package/core/print/normalize-printer.js +0 -1
  26. package/core/steps/all/core/01-parse-tree-sitter.d.ts +7 -0
  27. package/core/steps/pipeline/default-pipelines.d.ts +57 -47
  28. package/core/steps/pipeline/default-pipelines.js +23 -2
  29. package/core/steps/pipeline/pipeline.d.ts +1 -1
  30. package/core/steps/pipeline/pipeline.js +1 -1
  31. package/core/steps/pipeline-step.d.ts +1 -3
  32. package/dataflow/environments/resolve-by-name.d.ts +5 -2
  33. package/dataflow/environments/resolve-by-name.js +6 -4
  34. package/dataflow/extractor.d.ts +10 -0
  35. package/dataflow/extractor.js +10 -0
  36. package/dataflow/graph/resolve-graph.js +1 -1
  37. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +1 -1
  38. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +1 -1
  39. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +20 -4
  40. package/documentation/data/server/doc-data-server-messages.js +1 -2
  41. package/documentation/doc-util/doc-auto-gen.d.ts +1 -0
  42. package/documentation/doc-util/doc-auto-gen.js +5 -1
  43. package/documentation/doc-util/doc-benchmarks.d.ts +23 -0
  44. package/documentation/doc-util/doc-benchmarks.js +76 -0
  45. package/documentation/doc-util/doc-code.d.ts +1 -0
  46. package/documentation/doc-util/doc-code.js +4 -0
  47. package/documentation/doc-util/doc-dfg.d.ts +5 -3
  48. package/documentation/doc-util/doc-dfg.js +10 -8
  49. package/documentation/doc-util/doc-files.d.ts +2 -1
  50. package/documentation/doc-util/doc-files.js +3 -2
  51. package/documentation/doc-util/doc-normalized-ast.d.ts +2 -1
  52. package/documentation/doc-util/doc-normalized-ast.js +4 -5
  53. package/documentation/doc-util/doc-repl.d.ts +6 -2
  54. package/documentation/doc-util/doc-repl.js +10 -6
  55. package/documentation/doc-util/doc-server-message.js +1 -1
  56. package/documentation/doc-util/doc-structure.d.ts +1 -1
  57. package/documentation/doc-util/doc-structure.js +2 -2
  58. package/documentation/doc-util/doc-types.d.ts +8 -5
  59. package/documentation/doc-util/doc-types.js +31 -18
  60. package/documentation/index.d.ts +9 -0
  61. package/documentation/index.js +26 -0
  62. package/documentation/print-capabilities-markdown.js +105 -19
  63. package/documentation/print-core-wiki.d.ts +1 -0
  64. package/documentation/print-core-wiki.js +413 -0
  65. package/documentation/print-dataflow-graph-wiki.js +27 -27
  66. package/documentation/print-interface-wiki.js +22 -16
  67. package/documentation/print-linting-and-testing-wiki.js +29 -9
  68. package/documentation/print-normalized-ast-wiki.js +22 -17
  69. package/documentation/print-query-wiki.js +7 -7
  70. package/documentation/print-readme.d.ts +1 -0
  71. package/documentation/print-readme.js +160 -0
  72. package/documentation/print-search-wiki.js +2 -1
  73. package/package.json +30 -41
  74. package/queries/catalog/dependencies-query/dependencies-query-executor.js +77 -45
  75. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +3 -0
  76. package/queries/catalog/dependencies-query/dependencies-query-format.js +3 -2
  77. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -1
  78. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +1 -1
  79. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -1
  80. package/queries/catalog/search-query/search-query-format.js +1 -1
  81. package/r-bridge/data/data.d.ts +48 -7
  82. package/r-bridge/data/data.js +62 -8
  83. package/r-bridge/data/types.d.ts +7 -1
  84. package/r-bridge/lang-4.x/ast/model/model.d.ts +2 -3
  85. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +2 -0
  86. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +2 -5
  87. package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +6 -0
  88. package/r-bridge/lang-4.x/ast/parser/json/format.js +6 -0
  89. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +13 -2
  90. package/r-bridge/lang-4.x/ast/parser/json/parser.js +19 -3
  91. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.d.ts +3 -0
  92. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +3 -0
  93. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +1 -0
  94. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +3 -0
  95. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +6 -1
  96. package/r-bridge/parser.d.ts +10 -0
  97. package/r-bridge/parser.js +26 -2
  98. package/r-bridge/shell.js +18 -8
  99. package/search/flowr-search-builder.d.ts +1 -2
  100. package/search/flowr-search-builder.js +1 -3
  101. package/statistics/features/supported/comments/comments.js +17 -7
  102. package/statistics/features/supported/used-functions/post-process.js +0 -1
  103. package/statistics/features/supported/used-packages/used-packages.js +17 -7
  104. package/statistics/features/supported/values/values.js +17 -7
  105. package/statistics/summarizer/summarizer.js +1 -2
  106. package/util/files.js +17 -7
  107. package/util/json.js +0 -2
  108. package/util/mermaid/dfg.d.ts +3 -0
  109. package/util/mermaid/dfg.js +24 -8
  110. package/util/numbers.d.ts +1 -0
  111. package/util/numbers.js +5 -0
  112. package/util/parallel.js +17 -7
  113. package/util/quads.js +3 -3
  114. package/util/strings.d.ts +9 -0
  115. package/util/strings.js +14 -0
  116. package/util/version.js +1 -1
@@ -1,17 +1,50 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
5
35
  Object.defineProperty(exports, "__esModule", { value: true });
6
36
  exports.dataflowStarCommand = exports.dataflowCommand = void 0;
7
37
  const default_pipelines_1 = require("../../../core/steps/pipeline/default-pipelines");
8
38
  const retriever_1 = require("../../../r-bridge/retriever");
9
39
  const dfg_1 = require("../../../util/mermaid/dfg");
10
- const clipboardy_1 = __importDefault(require("clipboardy"));
40
+ const clipboard = Promise.resolve().then(() => __importStar(require('clipboardy')));
11
41
  const ansi_1 = require("../../../util/ansi");
12
- async function dataflow(parser, remainingLine) {
42
+ /**
43
+ * Obtain the dataflow graph using a known parser (such as the {@link RShell} or {@link TreeSitterExecutor}).
44
+ */
45
+ async function replGetDataflow(parser, code) {
13
46
  return await (0, default_pipelines_1.createDataflowPipeline)(parser, {
14
- request: (0, retriever_1.requestFromInput)(remainingLine.trim())
47
+ request: (0, retriever_1.requestFromInput)(code.trim())
15
48
  }).allRemainingSteps();
16
49
  }
17
50
  function handleString(code) {
@@ -26,14 +59,14 @@ exports.dataflowCommand = {
26
59
  aliases: ['d', 'df'],
27
60
  script: false,
28
61
  fn: async (output, shell, remainingLine) => {
29
- const result = await dataflow(shell, handleString(remainingLine));
62
+ const result = await replGetDataflow(shell, handleString(remainingLine));
30
63
  const mermaid = (0, dfg_1.graphToMermaid)({ graph: result.dataflow.graph, includeEnvironments: false }).string;
31
64
  output.stdout(mermaid);
32
65
  try {
33
- clipboardy_1.default.writeSync(mermaid);
66
+ (await clipboard).default.writeSync(mermaid);
34
67
  output.stdout(formatInfo(output, 'mermaid code', result.dataflow['.meta'].timing));
35
68
  }
36
- catch (e) { /* do nothing this is a service thing */ }
69
+ catch { /* do nothing this is a service thing */ }
37
70
  }
38
71
  };
39
72
  exports.dataflowStarCommand = {
@@ -42,14 +75,14 @@ exports.dataflowStarCommand = {
42
75
  aliases: ['d*', 'df*'],
43
76
  script: false,
44
77
  fn: async (output, shell, remainingLine) => {
45
- const result = await dataflow(shell, handleString(remainingLine));
78
+ const result = await replGetDataflow(shell, handleString(remainingLine));
46
79
  const mermaid = (0, dfg_1.graphToMermaidUrl)(result.dataflow.graph, false);
47
80
  output.stdout(mermaid);
48
81
  try {
49
- clipboardy_1.default.writeSync(mermaid);
82
+ (await clipboard).default.writeSync(mermaid);
50
83
  output.stdout(formatInfo(output, 'mermaid url', result.dataflow['.meta'].timing));
51
84
  }
52
- catch (e) { /* do nothing this is a service thing */ }
85
+ catch { /* do nothing this is a service thing */ }
53
86
  }
54
87
  };
55
88
  //# sourceMappingURL=repl-dataflow.js.map
@@ -1,13 +1,43 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
5
35
  Object.defineProperty(exports, "__esModule", { value: true });
6
36
  exports.normalizeStarCommand = exports.normalizeCommand = void 0;
7
37
  const default_pipelines_1 = require("../../../core/steps/pipeline/default-pipelines");
8
38
  const retriever_1 = require("../../../r-bridge/retriever");
9
39
  const ast_1 = require("../../../util/mermaid/ast");
10
- const clipboardy_1 = __importDefault(require("clipboardy"));
40
+ const clipboard = Promise.resolve().then(() => __importStar(require('clipboardy')));
11
41
  const ansi_1 = require("../../../util/ansi");
12
42
  async function normalize(parser, remainingLine) {
13
43
  return await (0, default_pipelines_1.createNormalizePipeline)(parser, {
@@ -30,10 +60,10 @@ exports.normalizeCommand = {
30
60
  const mermaid = (0, ast_1.normalizedAstToMermaid)(result.normalize.ast);
31
61
  output.stdout(mermaid);
32
62
  try {
33
- clipboardy_1.default.writeSync(mermaid);
63
+ (await clipboard).default.writeSync(mermaid);
34
64
  output.stdout(formatInfo(output, 'mermaid url', result.normalize['.meta'].timing));
35
65
  }
36
- catch (e) { /* do nothing this is a service thing */ }
66
+ catch { /* do nothing this is a service thing */ }
37
67
  }
38
68
  };
39
69
  exports.normalizeStarCommand = {
@@ -46,10 +76,10 @@ exports.normalizeStarCommand = {
46
76
  const mermaid = (0, ast_1.normalizedAstToMermaidUrl)(result.normalize.ast);
47
77
  output.stdout(mermaid);
48
78
  try {
49
- clipboardy_1.default.writeSync(mermaid);
79
+ (await clipboard).default.writeSync(mermaid);
50
80
  output.stdout(formatInfo(output, 'mermaid url', result.normalize['.meta'].timing));
51
81
  }
52
- catch (e) { /* do nothing this is a service thing */ }
82
+ catch { /* do nothing this is a service thing */ }
53
83
  }
54
84
  };
55
85
  //# sourceMappingURL=repl-normalize.js.map
@@ -17,7 +17,41 @@ function toDepthMap(entry) {
17
17
  result.push({ ...current, leaf: children.length === 0 });
18
18
  children.reverse();
19
19
  const nextDepth = current.depth + 1;
20
- visit.push(...children.map(c => ({ depth: nextDepth, node: c })));
20
+ for (const c of children) {
21
+ visit.push({ depth: nextDepth, node: c });
22
+ }
23
+ }
24
+ return result;
25
+ }
26
+ function treeSitterToJsonEntry(node) {
27
+ return {
28
+ token: node.type,
29
+ children: [],
30
+ text: node.text,
31
+ id: node.id,
32
+ parent: node.parent?.id ?? -1,
33
+ terminal: node.isNamed,
34
+ line1: node.startPosition.row + 1,
35
+ col1: node.startPosition.column + 1,
36
+ line2: node.endPosition.row + 1,
37
+ col2: node.endPosition.column + 1
38
+ };
39
+ }
40
+ function treeSitterToDepthList(node) {
41
+ const visit = [{ depth: 0, node }];
42
+ const result = [];
43
+ while (visit.length > 0) {
44
+ const current = visit.pop();
45
+ if (current === undefined) {
46
+ continue;
47
+ }
48
+ const children = current.node.children;
49
+ result.push({ depth: current.depth, node: treeSitterToJsonEntry(current.node), leaf: children.length === 0 });
50
+ children.reverse();
51
+ const nextDepth = current.depth + 1;
52
+ for (const c of children) {
53
+ visit.push({ depth: nextDepth, node: c });
54
+ }
21
55
  }
22
56
  return result;
23
57
  }
@@ -57,6 +91,9 @@ function retrieveLocationString(locationRaw) {
57
91
  if (extracted[0] === extracted[2] && extracted[1] === extracted[3]) {
58
92
  return ` (${extracted[0]}:${extracted[1]})`;
59
93
  }
94
+ else if (extracted[0] === extracted[2]) {
95
+ return ` (${extracted[0]}:${extracted[1]}─${extracted[3]})`;
96
+ }
60
97
  else {
61
98
  return ` (${extracted[0]}:${extracted[1]}─${extracted[2]}:${extracted[3]})`;
62
99
  }
@@ -66,6 +103,10 @@ function depthListToTextTree(list, f) {
66
103
  const deadDepths = new Set();
67
104
  let i = 0;
68
105
  for (const { depth, node, leaf } of list) {
106
+ if (depth > 10) {
107
+ result += '...';
108
+ break;
109
+ }
69
110
  const nextDepth = i + 1 < list.length ? list[i + 1].depth : 0;
70
111
  deadDepths.delete(depth);
71
112
  result += initialIndentation(i, depth, deadDepths, nextDepth, list, f);
@@ -99,7 +140,7 @@ exports.parseCommand = {
99
140
  }
100
141
  else {
101
142
  // print the tree-sitter ast
102
- output.stdout(JSON.stringify(result.parse.parsed, null, 2));
143
+ output.stdout(depthListToTextTree(treeSitterToDepthList(result.parse.parsed.rootNode), output.formatter));
103
144
  }
104
145
  }
105
146
  };
@@ -21,14 +21,14 @@ function printHelp(output) {
21
21
  output.stdout(`\n\nThe example ${(0, ansi_1.italic)(':query "[{\\"type\\": \\"call-context\\", \\"callName\\": \\"mean\\" }]" mean(1:10)', output.formatter)} would return the call context of the mean function.`);
22
22
  output.stdout('As a convenience, we interpret any (non-help, non-@) string not starting with \'[\' as a regex for the simple call-context query.');
23
23
  output.stdout(`Hence, ${(0, ansi_1.italic)(':query "mean" mean(1:10)', output.formatter)} is equivalent to the above example.`);
24
- output.stdout(`Similarly, '@<type>' is interpreted as a query of the given type.`);
24
+ output.stdout('Similarly, \'@<type>\' is interpreted as a query of the given type.');
25
25
  output.stdout(`With this, ${(0, ansi_1.italic)(':query @config', output.formatter)} prints the result of the config query.`);
26
26
  }
27
27
  async function processQueryArgs(line, parser, output) {
28
28
  const args = (0, args_1.splitAtEscapeSensitive)(line);
29
29
  const query = args.shift();
30
30
  if (!query) {
31
- output.stderr(`No query provided, use ':query help' to get more information.`);
31
+ output.stderr('No query provided, use \':query help\' to get more information.');
32
32
  return;
33
33
  }
34
34
  if (query === 'help') {
package/cli/repl/core.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
@@ -152,7 +162,6 @@ async function repl({ parser = new shell_1.RShell({ revive: 2 /* RShellReviveOpt
152
162
  rl.on('history', h => fs_1.default.writeFileSync(historyFile, h.join('\n'), { encoding: 'utf-8' }));
153
163
  }
154
164
  // the incredible repl :D, we kill it with ':quit'
155
- // eslint-disable-next-line no-constant-condition,@typescript-eslint/no-unnecessary-condition
156
165
  while (true) {
157
166
  await new Promise((resolve, reject) => {
158
167
  rl.question((0, prompt_1.prompt)(), answer => {
@@ -1,2 +1,3 @@
1
1
  import type { KnownParser } from '../../r-bridge/parser';
2
+ export declare function versionReplString(parser: KnownParser): Promise<string>;
2
3
  export declare function printVersionRepl(parser: KnownParser): Promise<void>;
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.versionReplString = versionReplString;
3
4
  exports.printVersionRepl = printVersionRepl;
4
5
  const repl_version_1 = require("./commands/repl-version");
5
- async function printVersionRepl(parser) {
6
+ async function versionReplString(parser) {
6
7
  const version = await (0, repl_version_1.retrieveVersionInformation)(parser);
7
- console.log(`flowR repl using flowR ${version.flowr}, R ${version.r}, engine ${version.engine}`);
8
+ const rVersion = version.r === 'none' ? '' : version.r === 'unknown' ? ', R version unknown' : `, R v${version.r}`;
9
+ const treeSitterVer = parser.name === 'tree-sitter' ? `, R grammar v${parser.treeSitterVersion()}` : '';
10
+ return `flowR repl using flowR v${version.flowr}${rVersion}${treeSitterVer} (${version.engine} engine)`;
11
+ }
12
+ async function printVersionRepl(parser) {
13
+ console.log(await versionReplString(parser));
8
14
  }
9
15
  //# sourceMappingURL=print-version.js.map
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
@@ -38,9 +48,6 @@ const core_1 = require("../core");
38
48
  const cfg_1 = require("../../../util/cfg/cfg");
39
49
  const quads_1 = require("../../../util/quads");
40
50
  const print_1 = require("../../../core/print/print");
41
- const _00_parse_1 = require("../../../core/steps/all/core/00-parse");
42
- const _10_normalize_1 = require("../../../core/steps/all/core/10-normalize");
43
- const _20_dataflow_1 = require("../../../core/steps/all/core/20-dataflow");
44
51
  const ansi_1 = require("../../../util/ansi");
45
52
  const default_pipelines_1 = require("../../../core/steps/pipeline/default-pipelines");
46
53
  const graph_1 = require("../../../dataflow/graph/graph");
@@ -136,7 +143,7 @@ class FlowRServerConnection {
136
143
  }
137
144
  const tempFile = tmp.fileSync({ postfix: '.R' });
138
145
  const slicer = this.createPipelineExecutorForRequest(message, tempFile.name);
139
- await slicer.allRemainingSteps(false).then(async (results) => await this.sendFileAnalysisResponse(results, message))
146
+ await slicer.allRemainingSteps(false).then(async (results) => await this.sendFileAnalysisResponse(slicer, results, message))
140
147
  .catch(e => {
141
148
  this.logger.error(`[${this.name}] Error while analyzing file ${message.filename ?? 'unknown file'}: ${String(e)}`);
142
149
  (0, send_1.sendMessage)(this.socket, {
@@ -149,13 +156,18 @@ class FlowRServerConnection {
149
156
  // this is an interestingly named function that means "I am a callback that removes a file" - so this deletes the file
150
157
  tempFile.removeCallback();
151
158
  }
152
- async sendFileAnalysisResponse(results, message) {
159
+ async sendFileAnalysisResponse(slicer, results, message) {
153
160
  let cfg = undefined;
154
161
  if (message.cfg) {
155
162
  cfg = (0, cfg_1.extractCFG)(results.normalize, results.dataflow?.graph);
156
163
  }
157
164
  const config = () => ({ context: message.filename ?? 'unknown', getId: (0, quads_1.defaultQuadIdGenerator)() });
158
165
  const sanitizedResults = sanitizeAnalysisResults(results);
166
+ const pipeline = slicer.getPipeline();
167
+ const parseStep = pipeline.steps.get('parse');
168
+ const normalizedStep = pipeline.steps.get('normalize');
169
+ const dataflowStep = pipeline.steps.get('dataflow');
170
+ (0, assert_1.guard)(parseStep !== undefined && normalizedStep !== undefined && dataflowStep !== undefined, 'All steps must be present');
159
171
  if (message.format === 'n-quads') {
160
172
  (0, send_1.sendMessage)(this.socket, {
161
173
  type: 'response-file-analysis',
@@ -163,9 +175,9 @@ class FlowRServerConnection {
163
175
  id: message.id,
164
176
  cfg: cfg ? (0, cfg_1.cfg2quads)(cfg, config()) : undefined,
165
177
  results: {
166
- parse: await (0, print_1.printStepResult)(_00_parse_1.PARSE_WITH_R_SHELL_STEP, sanitizedResults.parse, 5 /* StepOutputFormat.RdfQuads */, config()),
167
- normalize: await (0, print_1.printStepResult)(_10_normalize_1.NORMALIZE, sanitizedResults.normalize, 5 /* StepOutputFormat.RdfQuads */, config()),
168
- dataflow: await (0, print_1.printStepResult)(_20_dataflow_1.STATIC_DATAFLOW, sanitizedResults.dataflow, 5 /* StepOutputFormat.RdfQuads */, config())
178
+ parse: await (0, print_1.printStepResult)(parseStep, sanitizedResults.parse, 5 /* StepOutputFormat.RdfQuads */, config()),
179
+ normalize: await (0, print_1.printStepResult)(normalizedStep, sanitizedResults.normalize, 5 /* StepOutputFormat.RdfQuads */, config()),
180
+ dataflow: await (0, print_1.printStepResult)(dataflowStep, sanitizedResults.dataflow, 5 /* StepOutputFormat.RdfQuads */, config())
169
181
  }
170
182
  });
171
183
  }
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.baseMessage = void 0;
27
37
  /**
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.responseExecuteReplEndMessage = exports.responseExecuteReplIntermediateMessage = exports.requestExecuteReplExpressionMessage = void 0;
27
37
  const Joi = __importStar(require("joi"));
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.responseSliceMessage = exports.requestSliceMessage = void 0;
27
37
  const Joi = __importStar(require("joi"));
@@ -21,7 +21,6 @@ const time_1 = require("../../util/time");
21
21
  const tar_1 = require("tar");
22
22
  const ansi_1 = require("../../util/ansi");
23
23
  function compressFolder(folder, target) {
24
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
25
24
  return (0, tar_1.create)({
26
25
  gzip: true,
27
26
  file: target,
@@ -95,10 +95,16 @@ export declare class PipelineExecutor<P extends Pipeline> {
95
95
  * Construct a new pipeline executor.
96
96
  * The required additional input is specified by the {@link IPipelineStep#requiredInput|required input configuration} of each step in the `pipeline`.
97
97
  *
98
+ * Please see {@link createDataflowPipeline} and friends for engine agnostic shortcuts to create a pipeline executor.
99
+ *
98
100
  * @param pipeline - The {@link Pipeline} to execute, probably created with {@link createPipeline}.
99
101
  * @param input - External {@link PipelineInput|configuration and input} required to execute the given pipeline.
100
102
  */
101
103
  constructor(pipeline: P, input: PipelineInput<P>);
104
+ /**
105
+ * Retrieve the {@link Pipeline|pipeline} that is currently being.
106
+ */
107
+ getPipeline(): P;
102
108
  /**
103
109
  * Retrieve the current {@link PipelineStepStage|stage} the pipeline executor is in.
104
110
  *
@@ -99,6 +99,8 @@ class PipelineExecutor {
99
99
  * Construct a new pipeline executor.
100
100
  * The required additional input is specified by the {@link IPipelineStep#requiredInput|required input configuration} of each step in the `pipeline`.
101
101
  *
102
+ * Please see {@link createDataflowPipeline} and friends for engine agnostic shortcuts to create a pipeline executor.
103
+ *
102
104
  * @param pipeline - The {@link Pipeline} to execute, probably created with {@link createPipeline}.
103
105
  * @param input - External {@link PipelineInput|configuration and input} required to execute the given pipeline.
104
106
  */
@@ -114,6 +116,12 @@ class PipelineExecutor {
114
116
  }
115
117
  (0, built_in_config_1.registerBuiltInDefinitions)(builtIns.definitions);
116
118
  }
119
+ /**
120
+ * Retrieve the {@link Pipeline|pipeline} that is currently being.
121
+ */
122
+ getPipeline() {
123
+ return this.pipeline;
124
+ }
117
125
  /**
118
126
  * Retrieve the current {@link PipelineStepStage|stage} the pipeline executor is in.
119
127
  *
@@ -16,6 +16,9 @@ function mayObjectJson(d) {
16
16
  }
17
17
  }
18
18
  function objectJson(df) {
19
+ if (df === null) {
20
+ return 'null';
21
+ }
19
22
  const elems = [];
20
23
  for (const [key, value] of Object.entries(df)) {
21
24
  switch (typeof value) {
@@ -14,7 +14,6 @@ function normalizedAstToJson(ast) {
14
14
  if (k === 'fullLexeme') {
15
15
  return undefined;
16
16
  }
17
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
18
17
  return (0, json_1.jsonReplacer)(k, v);
19
18
  });
20
19
  }
@@ -5,6 +5,13 @@ import type { ParseRequiredInput } from '../../../../r-bridge/parser';
5
5
  export interface ParseStepOutputTS {
6
6
  readonly parsed: Tree;
7
7
  }
8
+ export interface TreeSitterParseJson {
9
+ readonly '.meta': {
10
+ readonly tokenCount: number;
11
+ readonly tokenCountNoComments: number;
12
+ };
13
+ readonly str: string;
14
+ }
8
15
  export declare const PARSE_WITH_TREE_SITTER_STEP: {
9
16
  readonly name: "parse";
10
17
  readonly humanReadableName: "parse with tree-sitter";