@eagleoutice/flowr 2.1.12 → 2.2.0

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 (93) hide show
  1. package/README.md +0 -1
  2. package/benchmark/slicer.d.ts +5 -12
  3. package/benchmark/slicer.js +46 -28
  4. package/cli/benchmark-app.d.ts +2 -0
  5. package/cli/benchmark-app.js +2 -1
  6. package/cli/benchmark-helper-app.d.ts +2 -0
  7. package/cli/benchmark-helper-app.js +2 -2
  8. package/cli/common/options.js +3 -1
  9. package/cli/flowr-main-options.js +36 -2
  10. package/cli/flowr.d.ts +6 -0
  11. package/cli/flowr.js +51 -24
  12. package/cli/repl/commands/repl-cfg.js +2 -4
  13. package/cli/repl/commands/repl-dataflow.js +2 -4
  14. package/cli/repl/commands/repl-execute.d.ts +2 -2
  15. package/cli/repl/commands/repl-execute.js +15 -5
  16. package/cli/repl/commands/repl-lineage.js +2 -4
  17. package/cli/repl/commands/repl-main.d.ts +2 -2
  18. package/cli/repl/commands/repl-normalize.js +2 -4
  19. package/cli/repl/commands/repl-parse.js +2 -4
  20. package/cli/repl/commands/repl-query.js +6 -8
  21. package/cli/repl/commands/repl-version.d.ts +5 -4
  22. package/cli/repl/commands/repl-version.js +10 -9
  23. package/cli/repl/core.d.ts +5 -5
  24. package/cli/repl/core.js +8 -12
  25. package/cli/repl/print-version.d.ts +2 -2
  26. package/cli/repl/print-version.js +3 -3
  27. package/cli/repl/server/connection.d.ts +3 -3
  28. package/cli/repl/server/connection.js +5 -7
  29. package/cli/repl/server/messages/message-hello.js +2 -1
  30. package/cli/repl/server/server.d.ts +4 -3
  31. package/cli/repl/server/server.js +7 -5
  32. package/cli/slicer-app.js +1 -1
  33. package/config.d.ts +36 -4
  34. package/config.js +30 -1
  35. package/core/pipeline-executor.d.ts +1 -1
  36. package/core/pipeline-executor.js +1 -1
  37. package/core/steps/all/core/00-parse.d.ts +4 -18
  38. package/core/steps/all/core/00-parse.js +2 -11
  39. package/core/steps/all/core/01-parse-tree-sitter.d.ts +23 -0
  40. package/core/steps/all/core/01-parse-tree-sitter.js +19 -0
  41. package/core/steps/all/core/10-normalize.d.ts +3 -2
  42. package/core/steps/all/core/10-normalize.js +1 -0
  43. package/core/steps/all/core/11-normalize-tree-sitter.d.ts +25 -0
  44. package/core/steps/all/core/11-normalize-tree-sitter.js +27 -0
  45. package/core/steps/all/core/20-dataflow.d.ts +2 -0
  46. package/core/steps/all/core/20-dataflow.js +1 -1
  47. package/core/steps/pipeline/default-pipelines.d.ts +368 -23
  48. package/core/steps/pipeline/default-pipelines.js +42 -4
  49. package/dataflow/extractor.d.ts +2 -1
  50. package/dataflow/extractor.js +2 -1
  51. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +6 -5
  52. package/dataflow/processor.d.ts +2 -0
  53. package/documentation/doc-util/doc-auto-gen.js +2 -1
  54. package/documentation/doc-util/doc-cfg.js +1 -1
  55. package/documentation/doc-util/doc-dfg.js +2 -2
  56. package/documentation/doc-util/doc-files.d.ts +1 -0
  57. package/documentation/doc-util/doc-files.js +4 -0
  58. package/documentation/doc-util/doc-normalized-ast.js +2 -3
  59. package/documentation/doc-util/doc-query.js +1 -1
  60. package/documentation/doc-util/doc-search.js +1 -1
  61. package/documentation/doc-util/doc-types.js +2 -2
  62. package/documentation/print-dataflow-graph-wiki.js +15 -15
  63. package/documentation/print-engines-wiki.d.ts +1 -0
  64. package/documentation/print-engines-wiki.js +82 -0
  65. package/documentation/print-interface-wiki.js +6 -7
  66. package/documentation/print-normalized-ast-wiki.js +1 -1
  67. package/package.json +9 -5
  68. package/queries/catalog/cluster-query/cluster-query-format.d.ts +5 -4
  69. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +5 -4
  70. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +5 -4
  71. package/queries/catalog/id-map-query/id-map-query-format.d.ts +5 -4
  72. package/queries/catalog/lineage-query/lineage-query-format.d.ts +5 -4
  73. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +5 -4
  74. package/queries/catalog/search-query/search-query-format.d.ts +5 -4
  75. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +5 -4
  76. package/queries/query.d.ts +40 -32
  77. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +4 -2
  78. package/r-bridge/lang-4.x/ast/parser/json/parser.js +5 -0
  79. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +18 -0
  80. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +57 -0
  81. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +3 -0
  82. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +541 -0
  83. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-types.d.ts +35 -0
  84. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-types.js +40 -0
  85. package/r-bridge/parser.d.ts +32 -0
  86. package/r-bridge/parser.js +14 -0
  87. package/r-bridge/shell-executor.d.ts +37 -1
  88. package/r-bridge/shell-executor.js +39 -0
  89. package/r-bridge/shell.d.ts +12 -6
  90. package/r-bridge/shell.js +15 -6
  91. package/search/search-optimizer/search-optimizer.js +1 -1
  92. package/statistics/statistics.js +1 -1
  93. package/util/version.js +1 -1
@@ -46,7 +46,7 @@ export declare const SupportedQueries: {
46
46
  readonly name: "parse";
47
47
  readonly humanReadableName: "parse with R shell";
48
48
  readonly description: "Parse the given R code into an AST";
49
- readonly processor: (_results: unknown, input: Partial<import("../core/steps/all/core/00-parse").ParseRequiredInput>) => Promise<import("../core/steps/all/core/00-parse").ParseStepOutput>;
49
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
50
50
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
51
51
  readonly printer: {
52
52
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -54,16 +54,16 @@ export declare const SupportedQueries: {
54
54
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
55
55
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
56
56
  };
57
- readonly 5: ({ parsed }: import("../core/steps/all/core/00-parse").ParseStepOutput, config: import("../util/quads").QuadSerializationConfiguration) => string;
57
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
58
58
  };
59
59
  readonly dependencies: readonly [];
60
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
60
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
61
61
  } | {
62
62
  readonly name: "normalize";
63
63
  readonly humanReadableName: "normalize";
64
64
  readonly description: "Normalize the AST to flowR's AST";
65
65
  readonly processor: (results: {
66
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
66
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
67
67
  }, input: Partial<import("../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../r-bridge/lang-4.x/ast/model/model").RNode<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
68
68
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
69
69
  readonly printer: {
@@ -81,6 +81,7 @@ export declare const SupportedQueries: {
81
81
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
82
82
  }, input: {
83
83
  request?: import("../r-bridge/retriever").RParseRequests;
84
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
84
85
  }) => import("../dataflow/info").DataflowInformation;
85
86
  readonly requiredInput: {};
86
87
  readonly name: "dataflow";
@@ -103,7 +104,7 @@ export declare const SupportedQueries: {
103
104
  readonly name: "parse";
104
105
  readonly humanReadableName: "parse with R shell";
105
106
  readonly description: "Parse the given R code into an AST";
106
- readonly processor: (_results: unknown, input: Partial<import("../core/steps/all/core/00-parse").ParseRequiredInput>) => Promise<import("../core/steps/all/core/00-parse").ParseStepOutput>;
107
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
107
108
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
108
109
  readonly printer: {
109
110
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -111,16 +112,16 @@ export declare const SupportedQueries: {
111
112
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
112
113
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
113
114
  };
114
- readonly 5: ({ parsed }: import("../core/steps/all/core/00-parse").ParseStepOutput, config: import("../util/quads").QuadSerializationConfiguration) => string;
115
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
115
116
  };
116
117
  readonly dependencies: readonly [];
117
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
118
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
118
119
  } | {
119
120
  readonly name: "normalize";
120
121
  readonly humanReadableName: "normalize";
121
122
  readonly description: "Normalize the AST to flowR's AST";
122
123
  readonly processor: (results: {
123
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
124
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
124
125
  }, input: Partial<import("../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../r-bridge/lang-4.x/ast/model/model").RNode<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
125
126
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
126
127
  readonly printer: {
@@ -138,6 +139,7 @@ export declare const SupportedQueries: {
138
139
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
139
140
  }, input: {
140
141
  request?: import("../r-bridge/retriever").RParseRequests;
142
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
141
143
  }) => import("../dataflow/info").DataflowInformation;
142
144
  readonly requiredInput: {};
143
145
  readonly name: "dataflow";
@@ -160,7 +162,7 @@ export declare const SupportedQueries: {
160
162
  readonly name: "parse";
161
163
  readonly humanReadableName: "parse with R shell";
162
164
  readonly description: "Parse the given R code into an AST";
163
- readonly processor: (_results: unknown, input: Partial<import("../core/steps/all/core/00-parse").ParseRequiredInput>) => Promise<import("../core/steps/all/core/00-parse").ParseStepOutput>;
165
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
164
166
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
165
167
  readonly printer: {
166
168
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -168,16 +170,16 @@ export declare const SupportedQueries: {
168
170
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
169
171
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
170
172
  };
171
- readonly 5: ({ parsed }: import("../core/steps/all/core/00-parse").ParseStepOutput, config: import("../util/quads").QuadSerializationConfiguration) => string;
173
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
172
174
  };
173
175
  readonly dependencies: readonly [];
174
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
176
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
175
177
  } | {
176
178
  readonly name: "normalize";
177
179
  readonly humanReadableName: "normalize";
178
180
  readonly description: "Normalize the AST to flowR's AST";
179
181
  readonly processor: (results: {
180
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
182
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
181
183
  }, input: Partial<import("../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../r-bridge/lang-4.x/ast/model/model").RNode<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
182
184
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
183
185
  readonly printer: {
@@ -195,6 +197,7 @@ export declare const SupportedQueries: {
195
197
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
196
198
  }, input: {
197
199
  request?: import("../r-bridge/retriever").RParseRequests;
200
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
198
201
  }) => import("../dataflow/info").DataflowInformation;
199
202
  readonly requiredInput: {};
200
203
  readonly name: "dataflow";
@@ -217,7 +220,7 @@ export declare const SupportedQueries: {
217
220
  readonly name: "parse";
218
221
  readonly humanReadableName: "parse with R shell";
219
222
  readonly description: "Parse the given R code into an AST";
220
- readonly processor: (_results: unknown, input: Partial<import("../core/steps/all/core/00-parse").ParseRequiredInput>) => Promise<import("../core/steps/all/core/00-parse").ParseStepOutput>;
223
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
221
224
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
222
225
  readonly printer: {
223
226
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -225,16 +228,16 @@ export declare const SupportedQueries: {
225
228
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
226
229
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
227
230
  };
228
- readonly 5: ({ parsed }: import("../core/steps/all/core/00-parse").ParseStepOutput, config: import("../util/quads").QuadSerializationConfiguration) => string;
231
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
229
232
  };
230
233
  readonly dependencies: readonly [];
231
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
234
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
232
235
  } | {
233
236
  readonly name: "normalize";
234
237
  readonly humanReadableName: "normalize";
235
238
  readonly description: "Normalize the AST to flowR's AST";
236
239
  readonly processor: (results: {
237
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
240
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
238
241
  }, input: Partial<import("../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../r-bridge/lang-4.x/ast/model/model").RNode<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
239
242
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
240
243
  readonly printer: {
@@ -252,6 +255,7 @@ export declare const SupportedQueries: {
252
255
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
253
256
  }, input: {
254
257
  request?: import("../r-bridge/retriever").RParseRequests;
258
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
255
259
  }) => import("../dataflow/info").DataflowInformation;
256
260
  readonly requiredInput: {};
257
261
  readonly name: "dataflow";
@@ -274,7 +278,7 @@ export declare const SupportedQueries: {
274
278
  readonly name: "parse";
275
279
  readonly humanReadableName: "parse with R shell";
276
280
  readonly description: "Parse the given R code into an AST";
277
- readonly processor: (_results: unknown, input: Partial<import("../core/steps/all/core/00-parse").ParseRequiredInput>) => Promise<import("../core/steps/all/core/00-parse").ParseStepOutput>;
281
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
278
282
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
279
283
  readonly printer: {
280
284
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -282,16 +286,16 @@ export declare const SupportedQueries: {
282
286
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
283
287
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
284
288
  };
285
- readonly 5: ({ parsed }: import("../core/steps/all/core/00-parse").ParseStepOutput, config: import("../util/quads").QuadSerializationConfiguration) => string;
289
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
286
290
  };
287
291
  readonly dependencies: readonly [];
288
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
292
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
289
293
  } | {
290
294
  readonly name: "normalize";
291
295
  readonly humanReadableName: "normalize";
292
296
  readonly description: "Normalize the AST to flowR's AST";
293
297
  readonly processor: (results: {
294
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
298
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
295
299
  }, input: Partial<import("../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../r-bridge/lang-4.x/ast/model/model").RNode<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
296
300
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
297
301
  readonly printer: {
@@ -309,6 +313,7 @@ export declare const SupportedQueries: {
309
313
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
310
314
  }, input: {
311
315
  request?: import("../r-bridge/retriever").RParseRequests;
316
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
312
317
  }) => import("../dataflow/info").DataflowInformation;
313
318
  readonly requiredInput: {};
314
319
  readonly name: "dataflow";
@@ -331,7 +336,7 @@ export declare const SupportedQueries: {
331
336
  readonly name: "parse";
332
337
  readonly humanReadableName: "parse with R shell";
333
338
  readonly description: "Parse the given R code into an AST";
334
- readonly processor: (_results: unknown, input: Partial<import("../core/steps/all/core/00-parse").ParseRequiredInput>) => Promise<import("../core/steps/all/core/00-parse").ParseStepOutput>;
339
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
335
340
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
336
341
  readonly printer: {
337
342
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -339,16 +344,16 @@ export declare const SupportedQueries: {
339
344
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
340
345
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
341
346
  };
342
- readonly 5: ({ parsed }: import("../core/steps/all/core/00-parse").ParseStepOutput, config: import("../util/quads").QuadSerializationConfiguration) => string;
347
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
343
348
  };
344
349
  readonly dependencies: readonly [];
345
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
350
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
346
351
  } | {
347
352
  readonly name: "normalize";
348
353
  readonly humanReadableName: "normalize";
349
354
  readonly description: "Normalize the AST to flowR's AST";
350
355
  readonly processor: (results: {
351
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
356
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
352
357
  }, input: Partial<import("../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../r-bridge/lang-4.x/ast/model/model").RNode<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
353
358
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
354
359
  readonly printer: {
@@ -366,6 +371,7 @@ export declare const SupportedQueries: {
366
371
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
367
372
  }, input: {
368
373
  request?: import("../r-bridge/retriever").RParseRequests;
374
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
369
375
  }) => import("../dataflow/info").DataflowInformation;
370
376
  readonly requiredInput: {};
371
377
  readonly name: "dataflow";
@@ -388,7 +394,7 @@ export declare const SupportedQueries: {
388
394
  readonly name: "parse";
389
395
  readonly humanReadableName: "parse with R shell";
390
396
  readonly description: "Parse the given R code into an AST";
391
- readonly processor: (_results: unknown, input: Partial<import("../core/steps/all/core/00-parse").ParseRequiredInput>) => Promise<import("../core/steps/all/core/00-parse").ParseStepOutput>;
397
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
392
398
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
393
399
  readonly printer: {
394
400
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -396,16 +402,16 @@ export declare const SupportedQueries: {
396
402
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
397
403
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
398
404
  };
399
- readonly 5: ({ parsed }: import("../core/steps/all/core/00-parse").ParseStepOutput, config: import("../util/quads").QuadSerializationConfiguration) => string;
405
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
400
406
  };
401
407
  readonly dependencies: readonly [];
402
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
408
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
403
409
  } | {
404
410
  readonly name: "normalize";
405
411
  readonly humanReadableName: "normalize";
406
412
  readonly description: "Normalize the AST to flowR's AST";
407
413
  readonly processor: (results: {
408
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
414
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
409
415
  }, input: Partial<import("../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../r-bridge/lang-4.x/ast/model/model").RNode<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
410
416
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
411
417
  readonly printer: {
@@ -423,6 +429,7 @@ export declare const SupportedQueries: {
423
429
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
424
430
  }, input: {
425
431
  request?: import("../r-bridge/retriever").RParseRequests;
432
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
426
433
  }) => import("../dataflow/info").DataflowInformation;
427
434
  readonly requiredInput: {};
428
435
  readonly name: "dataflow";
@@ -450,7 +457,7 @@ export declare const SupportedQueries: {
450
457
  readonly name: "parse";
451
458
  readonly humanReadableName: "parse with R shell";
452
459
  readonly description: "Parse the given R code into an AST";
453
- readonly processor: (_results: unknown, input: Partial<import("../core/steps/all/core/00-parse").ParseRequiredInput>) => Promise<import("../core/steps/all/core/00-parse").ParseStepOutput>;
460
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
454
461
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
455
462
  readonly printer: {
456
463
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -458,16 +465,16 @@ export declare const SupportedQueries: {
458
465
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
459
466
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
460
467
  };
461
- readonly 5: ({ parsed }: import("../core/steps/all/core/00-parse").ParseStepOutput, config: import("../util/quads").QuadSerializationConfiguration) => string;
468
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
462
469
  };
463
470
  readonly dependencies: readonly [];
464
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
471
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
465
472
  } | {
466
473
  readonly name: "normalize";
467
474
  readonly humanReadableName: "normalize";
468
475
  readonly description: "Normalize the AST to flowR's AST";
469
476
  readonly processor: (results: {
470
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
477
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
471
478
  }, input: Partial<import("../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../r-bridge/lang-4.x/ast/model/model").RNode<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
472
479
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
473
480
  readonly printer: {
@@ -485,6 +492,7 @@ export declare const SupportedQueries: {
485
492
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
486
493
  }, input: {
487
494
  request?: import("../r-bridge/retriever").RParseRequests;
495
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
488
496
  }) => import("../dataflow/info").DataflowInformation;
489
497
  readonly requiredInput: {};
490
498
  readonly name: "dataflow";
@@ -1,8 +1,10 @@
1
1
  import type { IdGenerator, NormalizedAst } from '../../model/processing/decorate';
2
2
  import type { NoInfo } from '../../model/model';
3
- import type { ParseStepOutput } from '../../../../../core/steps/all/core/00-parse';
3
+ import type { ParseStepOutputTS } from '../../../../../core/steps/all/core/01-parse-tree-sitter';
4
+ import type { ParseStepOutput } from '../../../../parser';
4
5
  export declare const parseLog: import("tslog").Logger<import("tslog").ILogObj>;
5
6
  /**
6
7
  * Take the output as produced by the parse step and normalize the AST from the R parser.
7
8
  */
8
- export declare function normalize({ parsed }: ParseStepOutput, getId?: IdGenerator<NoInfo>, file?: string): NormalizedAst;
9
+ export declare function normalize({ parsed }: ParseStepOutput<string>, getId?: IdGenerator<NoInfo>, file?: string): NormalizedAst;
10
+ export declare function normalizeTreeSitter({ parsed }: ParseStepOutputTS, getId?: IdGenerator<NoInfo>, file?: string): NormalizedAst;
@@ -2,10 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseLog = void 0;
4
4
  exports.normalize = normalize;
5
+ exports.normalizeTreeSitter = normalizeTreeSitter;
5
6
  const format_1 = require("./format");
6
7
  const log_1 = require("../../../../../util/log");
7
8
  const decorate_1 = require("../../model/processing/decorate");
8
9
  const normalize_root_1 = require("../main/internal/structure/normalize-root");
10
+ const tree_sitter_normalize_1 = require("../../../tree-sitter/tree-sitter-normalize");
9
11
  exports.parseLog = log_1.log.getSubLogger({ name: 'ast-parser' });
10
12
  /**
11
13
  * Take the output as produced by the parse step and normalize the AST from the R parser.
@@ -15,4 +17,7 @@ function normalize({ parsed }, getId = (0, decorate_1.deterministicCountingIdGen
15
17
  const object = (0, format_1.convertPreparedParsedData)((0, format_1.prepareParsedData)(parsed));
16
18
  return (0, decorate_1.decorateAst)((0, normalize_root_1.normalizeRootObjToAst)(data, object), { getId, file });
17
19
  }
20
+ function normalizeTreeSitter({ parsed }, getId = (0, decorate_1.deterministicCountingIdGenerator)(0), file) {
21
+ return (0, decorate_1.decorateAst)((0, tree_sitter_normalize_1.normalizeTreeSitterTreeToAst)(parsed), { getId, file });
22
+ }
18
23
  //# sourceMappingURL=parser.js.map
@@ -0,0 +1,18 @@
1
+ import Parser from 'web-tree-sitter';
2
+ import type { RParseRequest } from '../../retriever';
3
+ import type { SyncParser } from '../../parser';
4
+ export declare const DEFAULT_TREE_SITTER_R_WASM_PATH: string;
5
+ export declare const DEFAULT_TREE_SITTER_WASM_PATH: string;
6
+ /**
7
+ * Synchronous and (way) faster alternative to the {@link RShell} using tree-sitter.
8
+ */
9
+ export declare class TreeSitterExecutor implements SyncParser<Parser.Tree> {
10
+ readonly name = "tree-sitter";
11
+ readonly parser: Parser;
12
+ private static language;
13
+ static initTreeSitter(): Promise<void>;
14
+ constructor();
15
+ rVersion(): Promise<string | 'unknown' | 'none'>;
16
+ parse(request: RParseRequest): Parser.Tree;
17
+ close(): void;
18
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.TreeSitterExecutor = exports.DEFAULT_TREE_SITTER_WASM_PATH = exports.DEFAULT_TREE_SITTER_R_WASM_PATH = void 0;
7
+ const web_tree_sitter_1 = __importDefault(require("web-tree-sitter"));
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const config_1 = require("../../../config");
10
+ exports.DEFAULT_TREE_SITTER_R_WASM_PATH = `${__dirname}/tree-sitter-r.wasm`;
11
+ exports.DEFAULT_TREE_SITTER_WASM_PATH = `${__dirname}/tree-sitter.wasm`;
12
+ /**
13
+ * Synchronous and (way) faster alternative to the {@link RShell} using tree-sitter.
14
+ */
15
+ class TreeSitterExecutor {
16
+ name = 'tree-sitter';
17
+ parser;
18
+ static language;
19
+ static async initTreeSitter() {
20
+ const config = (0, config_1.getEngineConfig)('tree-sitter');
21
+ const treeSitterWasmPath = config?.treeSitterWasmPath ?? exports.DEFAULT_TREE_SITTER_WASM_PATH;
22
+ // noinspection JSUnusedGlobalSymbols - this is used by emscripten, see https://emscripten.org/docs/api_reference/module.html
23
+ await web_tree_sitter_1.default.init({
24
+ locateFile: (path, prefix) => {
25
+ // allow setting a custom path for the tree sitter wasm file
26
+ if (path.endsWith('tree-sitter.wasm')) {
27
+ return treeSitterWasmPath;
28
+ }
29
+ return prefix + path;
30
+ }
31
+ });
32
+ const wasmPath = config?.wasmPath ?? exports.DEFAULT_TREE_SITTER_R_WASM_PATH;
33
+ TreeSitterExecutor.language = await web_tree_sitter_1.default.Language.load(wasmPath);
34
+ }
35
+ constructor() {
36
+ this.parser = new web_tree_sitter_1.default();
37
+ this.parser.setLanguage(TreeSitterExecutor.language);
38
+ }
39
+ rVersion() {
40
+ return Promise.resolve('none');
41
+ }
42
+ parse(request) {
43
+ let sourceCode;
44
+ if (request.request === 'file') {
45
+ sourceCode = fs_1.default.readFileSync(request.content, 'utf8');
46
+ }
47
+ else {
48
+ sourceCode = request.content;
49
+ }
50
+ return this.parser.parse(sourceCode);
51
+ }
52
+ close() {
53
+ this.parser.delete();
54
+ }
55
+ }
56
+ exports.TreeSitterExecutor = TreeSitterExecutor;
57
+ //# sourceMappingURL=tree-sitter-executor.js.map
@@ -0,0 +1,3 @@
1
+ import type { RExpressionList } from '../ast/model/nodes/r-expression-list';
2
+ import type { Tree } from 'web-tree-sitter';
3
+ export declare function normalizeTreeSitterTreeToAst(tree: Tree): RExpressionList;