@eagleoutice/flowr 2.1.12 → 2.2.1

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 (107) 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/environments/resolve-by-name.js +5 -4
  50. package/dataflow/extractor.d.ts +2 -1
  51. package/dataflow/extractor.js +2 -1
  52. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +6 -5
  53. package/dataflow/processor.d.ts +2 -0
  54. package/documentation/doc-util/doc-auto-gen.js +2 -1
  55. package/documentation/doc-util/doc-cfg.js +1 -1
  56. package/documentation/doc-util/doc-dfg.js +2 -2
  57. package/documentation/doc-util/doc-files.d.ts +1 -0
  58. package/documentation/doc-util/doc-files.js +4 -0
  59. package/documentation/doc-util/doc-normalized-ast.js +2 -3
  60. package/documentation/doc-util/doc-query.js +1 -1
  61. package/documentation/doc-util/doc-search.js +1 -1
  62. package/documentation/doc-util/doc-types.js +2 -2
  63. package/documentation/print-dataflow-graph-wiki.js +15 -15
  64. package/documentation/print-engines-wiki.d.ts +1 -0
  65. package/documentation/print-engines-wiki.js +82 -0
  66. package/documentation/print-interface-wiki.js +6 -7
  67. package/documentation/print-normalized-ast-wiki.js +1 -1
  68. package/documentation/print-query-wiki.js +24 -0
  69. package/package.json +9 -5
  70. package/queries/catalog/cluster-query/cluster-query-format.d.ts +5 -4
  71. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +5 -4
  72. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +5 -4
  73. package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +3 -0
  74. package/queries/catalog/happens-before-query/happens-before-query-executor.js +36 -0
  75. package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +71 -0
  76. package/queries/catalog/happens-before-query/happens-before-query-format.js +27 -0
  77. package/queries/catalog/id-map-query/id-map-query-format.d.ts +5 -4
  78. package/queries/catalog/lineage-query/lineage-query-format.d.ts +5 -4
  79. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +5 -4
  80. package/queries/catalog/search-query/search-query-executor.js +0 -4
  81. package/queries/catalog/search-query/search-query-format.d.ts +5 -4
  82. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +5 -4
  83. package/queries/query.d.ts +100 -33
  84. package/queries/query.js +3 -1
  85. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +4 -2
  86. package/r-bridge/lang-4.x/ast/parser/json/parser.js +5 -0
  87. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +18 -0
  88. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +57 -0
  89. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +3 -0
  90. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +541 -0
  91. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-types.d.ts +35 -0
  92. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-types.js +40 -0
  93. package/r-bridge/parser.d.ts +32 -0
  94. package/r-bridge/parser.js +14 -0
  95. package/r-bridge/shell-executor.d.ts +37 -1
  96. package/r-bridge/shell-executor.js +39 -0
  97. package/r-bridge/shell.d.ts +12 -6
  98. package/r-bridge/shell.js +15 -6
  99. package/search/search-optimizer/search-optimizer.js +1 -1
  100. package/statistics/statistics.js +1 -1
  101. package/util/cfg/cfg.d.ts +2 -0
  102. package/util/cfg/cfg.js +8 -8
  103. package/util/cfg/happens-before.d.ts +7 -0
  104. package/util/cfg/happens-before.js +32 -0
  105. package/util/logic.d.ts +4 -4
  106. package/util/logic.js +8 -0
  107. package/util/version.js +1 -1
@@ -16,7 +16,8 @@ import Joi from 'joi';
16
16
  import type { LocationMapQuery } from './catalog/location-map-query/location-map-query-format';
17
17
  import type { ConfigQuery } from './catalog/config-query/config-query-format';
18
18
  import type { SearchQuery } from './catalog/search-query/search-query-format';
19
- export type Query = CallContextQuery | ConfigQuery | SearchQuery | DataflowQuery | NormalizedAstQuery | IdMapQuery | DataflowClusterQuery | StaticSliceQuery | LineageQuery | DependenciesQuery | LocationMapQuery;
19
+ import type { HappensBeforeQuery } from './catalog/happens-before-query/happens-before-query-format';
20
+ export type Query = CallContextQuery | ConfigQuery | SearchQuery | DataflowQuery | NormalizedAstQuery | IdMapQuery | DataflowClusterQuery | StaticSliceQuery | LineageQuery | DependenciesQuery | LocationMapQuery | HappensBeforeQuery;
20
21
  export type QueryArgumentsWithType<QueryType extends BaseQueryFormat['type']> = Query & {
21
22
  type: QueryType;
22
23
  };
@@ -46,7 +47,7 @@ export declare const SupportedQueries: {
46
47
  readonly name: "parse";
47
48
  readonly humanReadableName: "parse with R shell";
48
49
  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>;
50
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
50
51
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
51
52
  readonly printer: {
52
53
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -54,16 +55,16 @@ export declare const SupportedQueries: {
54
55
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
55
56
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
56
57
  };
57
- readonly 5: ({ parsed }: import("../core/steps/all/core/00-parse").ParseStepOutput, config: import("../util/quads").QuadSerializationConfiguration) => string;
58
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
58
59
  };
59
60
  readonly dependencies: readonly [];
60
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
61
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
61
62
  } | {
62
63
  readonly name: "normalize";
63
64
  readonly humanReadableName: "normalize";
64
65
  readonly description: "Normalize the AST to flowR's AST";
65
66
  readonly processor: (results: {
66
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
67
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
67
68
  }, 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
69
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
69
70
  readonly printer: {
@@ -81,6 +82,7 @@ export declare const SupportedQueries: {
81
82
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
82
83
  }, input: {
83
84
  request?: import("../r-bridge/retriever").RParseRequests;
85
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
84
86
  }) => import("../dataflow/info").DataflowInformation;
85
87
  readonly requiredInput: {};
86
88
  readonly name: "dataflow";
@@ -103,7 +105,7 @@ export declare const SupportedQueries: {
103
105
  readonly name: "parse";
104
106
  readonly humanReadableName: "parse with R shell";
105
107
  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>;
108
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
107
109
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
108
110
  readonly printer: {
109
111
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -111,16 +113,16 @@ export declare const SupportedQueries: {
111
113
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
112
114
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
113
115
  };
114
- readonly 5: ({ parsed }: import("../core/steps/all/core/00-parse").ParseStepOutput, config: import("../util/quads").QuadSerializationConfiguration) => string;
116
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
115
117
  };
116
118
  readonly dependencies: readonly [];
117
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
119
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
118
120
  } | {
119
121
  readonly name: "normalize";
120
122
  readonly humanReadableName: "normalize";
121
123
  readonly description: "Normalize the AST to flowR's AST";
122
124
  readonly processor: (results: {
123
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
125
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
124
126
  }, 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
127
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
126
128
  readonly printer: {
@@ -138,6 +140,7 @@ export declare const SupportedQueries: {
138
140
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
139
141
  }, input: {
140
142
  request?: import("../r-bridge/retriever").RParseRequests;
143
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
141
144
  }) => import("../dataflow/info").DataflowInformation;
142
145
  readonly requiredInput: {};
143
146
  readonly name: "dataflow";
@@ -160,7 +163,7 @@ export declare const SupportedQueries: {
160
163
  readonly name: "parse";
161
164
  readonly humanReadableName: "parse with R shell";
162
165
  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>;
166
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
164
167
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
165
168
  readonly printer: {
166
169
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -168,16 +171,16 @@ export declare const SupportedQueries: {
168
171
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
169
172
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
170
173
  };
171
- readonly 5: ({ parsed }: import("../core/steps/all/core/00-parse").ParseStepOutput, config: import("../util/quads").QuadSerializationConfiguration) => string;
174
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
172
175
  };
173
176
  readonly dependencies: readonly [];
174
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
177
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
175
178
  } | {
176
179
  readonly name: "normalize";
177
180
  readonly humanReadableName: "normalize";
178
181
  readonly description: "Normalize the AST to flowR's AST";
179
182
  readonly processor: (results: {
180
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
183
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
181
184
  }, 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
185
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
183
186
  readonly printer: {
@@ -195,6 +198,7 @@ export declare const SupportedQueries: {
195
198
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
196
199
  }, input: {
197
200
  request?: import("../r-bridge/retriever").RParseRequests;
201
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
198
202
  }) => import("../dataflow/info").DataflowInformation;
199
203
  readonly requiredInput: {};
200
204
  readonly name: "dataflow";
@@ -217,7 +221,7 @@ export declare const SupportedQueries: {
217
221
  readonly name: "parse";
218
222
  readonly humanReadableName: "parse with R shell";
219
223
  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>;
224
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
221
225
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
222
226
  readonly printer: {
223
227
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -225,16 +229,16 @@ export declare const SupportedQueries: {
225
229
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
226
230
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
227
231
  };
228
- readonly 5: ({ parsed }: import("../core/steps/all/core/00-parse").ParseStepOutput, config: import("../util/quads").QuadSerializationConfiguration) => string;
232
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
229
233
  };
230
234
  readonly dependencies: readonly [];
231
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
235
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
232
236
  } | {
233
237
  readonly name: "normalize";
234
238
  readonly humanReadableName: "normalize";
235
239
  readonly description: "Normalize the AST to flowR's AST";
236
240
  readonly processor: (results: {
237
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
241
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
238
242
  }, 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
243
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
240
244
  readonly printer: {
@@ -252,6 +256,7 @@ export declare const SupportedQueries: {
252
256
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
253
257
  }, input: {
254
258
  request?: import("../r-bridge/retriever").RParseRequests;
259
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
255
260
  }) => import("../dataflow/info").DataflowInformation;
256
261
  readonly requiredInput: {};
257
262
  readonly name: "dataflow";
@@ -274,7 +279,7 @@ export declare const SupportedQueries: {
274
279
  readonly name: "parse";
275
280
  readonly humanReadableName: "parse with R shell";
276
281
  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>;
282
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
278
283
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
279
284
  readonly printer: {
280
285
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -282,16 +287,16 @@ export declare const SupportedQueries: {
282
287
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
283
288
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
284
289
  };
285
- readonly 5: ({ parsed }: import("../core/steps/all/core/00-parse").ParseStepOutput, config: import("../util/quads").QuadSerializationConfiguration) => string;
290
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
286
291
  };
287
292
  readonly dependencies: readonly [];
288
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
293
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
289
294
  } | {
290
295
  readonly name: "normalize";
291
296
  readonly humanReadableName: "normalize";
292
297
  readonly description: "Normalize the AST to flowR's AST";
293
298
  readonly processor: (results: {
294
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
299
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
295
300
  }, 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
301
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
297
302
  readonly printer: {
@@ -309,6 +314,7 @@ export declare const SupportedQueries: {
309
314
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
310
315
  }, input: {
311
316
  request?: import("../r-bridge/retriever").RParseRequests;
317
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
312
318
  }) => import("../dataflow/info").DataflowInformation;
313
319
  readonly requiredInput: {};
314
320
  readonly name: "dataflow";
@@ -331,7 +337,7 @@ export declare const SupportedQueries: {
331
337
  readonly name: "parse";
332
338
  readonly humanReadableName: "parse with R shell";
333
339
  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>;
340
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
335
341
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
336
342
  readonly printer: {
337
343
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -339,16 +345,16 @@ export declare const SupportedQueries: {
339
345
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
340
346
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
341
347
  };
342
- readonly 5: ({ parsed }: import("../core/steps/all/core/00-parse").ParseStepOutput, config: import("../util/quads").QuadSerializationConfiguration) => string;
348
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
343
349
  };
344
350
  readonly dependencies: readonly [];
345
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
351
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
346
352
  } | {
347
353
  readonly name: "normalize";
348
354
  readonly humanReadableName: "normalize";
349
355
  readonly description: "Normalize the AST to flowR's AST";
350
356
  readonly processor: (results: {
351
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
357
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
352
358
  }, 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
359
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
354
360
  readonly printer: {
@@ -366,6 +372,7 @@ export declare const SupportedQueries: {
366
372
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
367
373
  }, input: {
368
374
  request?: import("../r-bridge/retriever").RParseRequests;
375
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
369
376
  }) => import("../dataflow/info").DataflowInformation;
370
377
  readonly requiredInput: {};
371
378
  readonly name: "dataflow";
@@ -388,7 +395,7 @@ export declare const SupportedQueries: {
388
395
  readonly name: "parse";
389
396
  readonly humanReadableName: "parse with R shell";
390
397
  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>;
398
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
392
399
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
393
400
  readonly printer: {
394
401
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -396,16 +403,16 @@ export declare const SupportedQueries: {
396
403
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
397
404
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
398
405
  };
399
- readonly 5: ({ parsed }: import("../core/steps/all/core/00-parse").ParseStepOutput, config: import("../util/quads").QuadSerializationConfiguration) => string;
406
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
400
407
  };
401
408
  readonly dependencies: readonly [];
402
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
409
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
403
410
  } | {
404
411
  readonly name: "normalize";
405
412
  readonly humanReadableName: "normalize";
406
413
  readonly description: "Normalize the AST to flowR's AST";
407
414
  readonly processor: (results: {
408
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
415
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
409
416
  }, 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
417
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
411
418
  readonly printer: {
@@ -423,6 +430,7 @@ export declare const SupportedQueries: {
423
430
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
424
431
  }, input: {
425
432
  request?: import("../r-bridge/retriever").RParseRequests;
433
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
426
434
  }) => import("../dataflow/info").DataflowInformation;
427
435
  readonly requiredInput: {};
428
436
  readonly name: "dataflow";
@@ -450,7 +458,7 @@ export declare const SupportedQueries: {
450
458
  readonly name: "parse";
451
459
  readonly humanReadableName: "parse with R shell";
452
460
  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>;
461
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
454
462
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
455
463
  readonly printer: {
456
464
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -458,16 +466,16 @@ export declare const SupportedQueries: {
458
466
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
459
467
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
460
468
  };
461
- readonly 5: ({ parsed }: import("../core/steps/all/core/00-parse").ParseStepOutput, config: import("../util/quads").QuadSerializationConfiguration) => string;
469
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
462
470
  };
463
471
  readonly dependencies: readonly [];
464
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
472
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
465
473
  } | {
466
474
  readonly name: "normalize";
467
475
  readonly humanReadableName: "normalize";
468
476
  readonly description: "Normalize the AST to flowR's AST";
469
477
  readonly processor: (results: {
470
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
478
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
471
479
  }, 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
480
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
473
481
  readonly printer: {
@@ -485,6 +493,65 @@ export declare const SupportedQueries: {
485
493
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
486
494
  }, input: {
487
495
  request?: import("../r-bridge/retriever").RParseRequests;
496
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
497
+ }) => import("../dataflow/info").DataflowInformation;
498
+ readonly requiredInput: {};
499
+ readonly name: "dataflow";
500
+ readonly description: "Construct the dataflow graph";
501
+ readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
502
+ readonly printer: {
503
+ readonly 0: typeof import("../core/print/print").internalPrinter;
504
+ readonly 2: typeof import("../core/print/dataflow-printer").dataflowGraphToJson;
505
+ readonly 5: typeof import("../core/print/dataflow-printer").dataflowGraphToQuads;
506
+ readonly 3: typeof import("../core/print/dataflow-printer").dataflowGraphToMermaid;
507
+ readonly 4: typeof import("../core/print/dataflow-printer").dataflowGraphToMermaidUrl;
508
+ };
509
+ readonly dependencies: readonly ["normalize"];
510
+ }>>, queryResults: BaseQueryResult, result: string[]) => true;
511
+ readonly schema: Joi.ObjectSchema<any>;
512
+ };
513
+ readonly 'happens-before': {
514
+ readonly executor: typeof import("./catalog/happens-before-query/happens-before-query-executor").executeHappensBefore;
515
+ readonly asciiSummarizer: (formatter: OutputFormatter, _processed: PipelineOutput<import("../core/steps/pipeline/pipeline").Pipeline<{
516
+ readonly name: "parse";
517
+ readonly humanReadableName: "parse with R shell";
518
+ readonly description: "Parse the given R code into an AST";
519
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
520
+ readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
521
+ readonly printer: {
522
+ readonly 0: typeof import("../core/print/print").internalPrinter;
523
+ readonly 2: {
524
+ (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
525
+ (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
526
+ };
527
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
528
+ };
529
+ readonly dependencies: readonly [];
530
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
531
+ } | {
532
+ readonly name: "normalize";
533
+ readonly humanReadableName: "normalize";
534
+ readonly description: "Normalize the AST to flowR's AST";
535
+ readonly processor: (results: {
536
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
537
+ }, 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>>;
538
+ readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
539
+ readonly printer: {
540
+ readonly 0: typeof import("../core/print/print").internalPrinter;
541
+ readonly 2: typeof import("../core/print/normalize-printer").normalizedAstToJson;
542
+ readonly 5: typeof import("../core/print/normalize-printer").normalizedAstToQuads;
543
+ readonly 3: typeof import("../core/print/normalize-printer").printNormalizedAstToMermaid;
544
+ readonly 4: typeof import("../core/print/normalize-printer").printNormalizedAstToMermaidUrl;
545
+ };
546
+ readonly dependencies: readonly ["parse"];
547
+ readonly requiredInput: import("../core/steps/all/core/10-normalize").NormalizeRequiredInput;
548
+ } | {
549
+ readonly humanReadableName: "dataflow";
550
+ readonly processor: (results: {
551
+ normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
552
+ }, input: {
553
+ request?: import("../r-bridge/retriever").RParseRequests;
554
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
488
555
  }) => import("../dataflow/info").DataflowInformation;
489
556
  readonly requiredInput: {};
490
557
  readonly name: "dataflow";
package/queries/query.js CHANGED
@@ -24,6 +24,7 @@ const joi_1 = __importDefault(require("joi"));
24
24
  const location_map_query_format_1 = require("./catalog/location-map-query/location-map-query-format");
25
25
  const config_query_format_1 = require("./catalog/config-query/config-query-format");
26
26
  const search_query_format_1 = require("./catalog/search-query/search-query-format");
27
+ const happens_before_query_format_1 = require("./catalog/happens-before-query/happens-before-query-format");
27
28
  exports.SupportedQueries = {
28
29
  'call-context': call_context_query_format_1.CallContextQueryDefinition,
29
30
  'config': config_query_format_1.ConfigQueryDefinition,
@@ -35,7 +36,8 @@ exports.SupportedQueries = {
35
36
  'lineage': lineage_query_format_1.LineageQueryDefinition,
36
37
  'dependencies': dependencies_query_format_1.DependenciesQueryDefinition,
37
38
  'location-map': location_map_query_format_1.LocationMapQueryDefinition,
38
- 'search': search_query_format_1.SearchQueryDefinition
39
+ 'search': search_query_format_1.SearchQueryDefinition,
40
+ 'happens-before': happens_before_query_format_1.HappensBeforeQueryDefinition
39
41
  };
40
42
  function executeQueriesOfSameType(data, ...queries) {
41
43
  (0, assert_1.guard)(queries.length > 0, 'At least one query must be provided');
@@ -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;