@eagleoutice/flowr 2.1.11 → 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 (137) hide show
  1. package/benchmark/slicer.d.ts +5 -12
  2. package/benchmark/slicer.js +46 -28
  3. package/cli/benchmark-app.d.ts +2 -0
  4. package/cli/benchmark-app.js +2 -1
  5. package/cli/benchmark-helper-app.d.ts +2 -0
  6. package/cli/benchmark-helper-app.js +2 -2
  7. package/cli/common/options.js +3 -1
  8. package/cli/flowr-main-options.js +36 -2
  9. package/cli/flowr.d.ts +6 -0
  10. package/cli/flowr.js +51 -24
  11. package/cli/repl/commands/repl-cfg.js +2 -4
  12. package/cli/repl/commands/repl-dataflow.js +2 -4
  13. package/cli/repl/commands/repl-execute.d.ts +2 -2
  14. package/cli/repl/commands/repl-execute.js +15 -5
  15. package/cli/repl/commands/repl-lineage.js +2 -4
  16. package/cli/repl/commands/repl-main.d.ts +2 -2
  17. package/cli/repl/commands/repl-normalize.js +2 -4
  18. package/cli/repl/commands/repl-parse.js +2 -4
  19. package/cli/repl/commands/repl-query.js +7 -9
  20. package/cli/repl/commands/repl-version.d.ts +5 -4
  21. package/cli/repl/commands/repl-version.js +10 -9
  22. package/cli/repl/core.d.ts +5 -5
  23. package/cli/repl/core.js +8 -12
  24. package/cli/repl/print-version.d.ts +2 -2
  25. package/cli/repl/print-version.js +3 -3
  26. package/cli/repl/server/connection.d.ts +3 -3
  27. package/cli/repl/server/connection.js +6 -8
  28. package/cli/repl/server/messages/message-hello.js +2 -1
  29. package/cli/repl/server/server.d.ts +4 -3
  30. package/cli/repl/server/server.js +7 -5
  31. package/cli/slicer-app.js +1 -1
  32. package/config.d.ts +36 -4
  33. package/config.js +30 -1
  34. package/core/pipeline-executor.d.ts +1 -1
  35. package/core/pipeline-executor.js +1 -1
  36. package/core/steps/all/core/00-parse.d.ts +4 -18
  37. package/core/steps/all/core/00-parse.js +2 -11
  38. package/core/steps/all/core/01-parse-tree-sitter.d.ts +23 -0
  39. package/core/steps/all/core/01-parse-tree-sitter.js +19 -0
  40. package/core/steps/all/core/10-normalize.d.ts +3 -2
  41. package/core/steps/all/core/10-normalize.js +1 -0
  42. package/core/steps/all/core/11-normalize-tree-sitter.d.ts +25 -0
  43. package/core/steps/all/core/11-normalize-tree-sitter.js +27 -0
  44. package/core/steps/all/core/20-dataflow.d.ts +2 -0
  45. package/core/steps/all/core/20-dataflow.js +1 -1
  46. package/core/steps/pipeline/default-pipelines.d.ts +374 -23
  47. package/core/steps/pipeline/default-pipelines.js +48 -4
  48. package/dataflow/extractor.d.ts +2 -1
  49. package/dataflow/extractor.js +2 -1
  50. package/dataflow/graph/vertex.d.ts +4 -0
  51. package/dataflow/graph/vertex.js +3 -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 +3 -3
  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 +2 -2
  61. package/documentation/doc-util/doc-search.d.ts +25 -0
  62. package/documentation/doc-util/doc-search.js +121 -0
  63. package/documentation/doc-util/doc-types.d.ts +10 -2
  64. package/documentation/doc-util/doc-types.js +81 -3
  65. package/documentation/print-dataflow-graph-wiki.js +16 -16
  66. package/documentation/print-engines-wiki.d.ts +1 -0
  67. package/documentation/print-engines-wiki.js +82 -0
  68. package/documentation/print-interface-wiki.js +30 -20
  69. package/documentation/print-normalized-ast-wiki.js +5 -5
  70. package/documentation/print-query-wiki.js +22 -0
  71. package/documentation/print-search-wiki.d.ts +1 -0
  72. package/documentation/print-search-wiki.js +74 -0
  73. package/package.json +10 -5
  74. package/queries/base-query-format.d.ts +2 -2
  75. package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
  76. package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
  77. package/queries/catalog/cluster-query/cluster-query-executor.d.ts +1 -1
  78. package/queries/catalog/cluster-query/cluster-query-executor.js +1 -1
  79. package/queries/catalog/cluster-query/cluster-query-format.d.ts +5 -4
  80. package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +1 -1
  81. package/queries/catalog/dataflow-query/dataflow-query-executor.js +1 -1
  82. package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +5 -4
  83. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -2
  84. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +5 -4
  85. package/queries/catalog/id-map-query/id-map-query-format.d.ts +5 -4
  86. package/queries/catalog/lineage-query/lineage-query-executor.d.ts +1 -1
  87. package/queries/catalog/lineage-query/lineage-query-executor.js +1 -1
  88. package/queries/catalog/lineage-query/lineage-query-format.d.ts +5 -4
  89. package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +5 -4
  90. package/queries/catalog/search-query/search-query-executor.d.ts +3 -0
  91. package/queries/catalog/search-query/search-query-executor.js +27 -0
  92. package/queries/catalog/search-query/search-query-format.d.ts +73 -0
  93. package/queries/catalog/search-query/search-query-format.js +29 -0
  94. package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +1 -1
  95. package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
  96. package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +5 -4
  97. package/queries/query.d.ts +95 -29
  98. package/queries/query.js +3 -1
  99. package/r-bridge/lang-4.x/ast/model/type.d.ts +4 -0
  100. package/r-bridge/lang-4.x/ast/model/type.js +3 -1
  101. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +4 -2
  102. package/r-bridge/lang-4.x/ast/parser/json/parser.js +5 -0
  103. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +18 -0
  104. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +57 -0
  105. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +3 -0
  106. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +541 -0
  107. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-types.d.ts +35 -0
  108. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-types.js +40 -0
  109. package/r-bridge/parser.d.ts +32 -0
  110. package/r-bridge/parser.js +14 -0
  111. package/r-bridge/shell-executor.d.ts +37 -1
  112. package/r-bridge/shell-executor.js +39 -0
  113. package/r-bridge/shell.d.ts +12 -6
  114. package/r-bridge/shell.js +15 -6
  115. package/search/flowr-search-builder.d.ts +193 -0
  116. package/search/flowr-search-builder.js +192 -0
  117. package/search/flowr-search-executor.d.ts +9 -0
  118. package/search/flowr-search-executor.js +16 -0
  119. package/search/flowr-search-filters.d.ts +74 -0
  120. package/search/flowr-search-filters.js +136 -0
  121. package/search/flowr-search-printer.d.ts +10 -0
  122. package/search/flowr-search-printer.js +85 -0
  123. package/search/flowr-search-traverse.d.ts +7 -0
  124. package/search/flowr-search-traverse.js +12 -0
  125. package/search/flowr-search.d.ts +58 -0
  126. package/search/flowr-search.js +29 -0
  127. package/search/search-executor/search-generators.d.ts +37 -0
  128. package/search/search-executor/search-generators.js +64 -0
  129. package/search/search-executor/search-transformer.d.ts +57 -0
  130. package/search/search-executor/search-transformer.js +99 -0
  131. package/search/search-optimizer/search-optimizer.d.ts +9 -0
  132. package/search/search-optimizer/search-optimizer.js +89 -0
  133. package/statistics/statistics.js +1 -1
  134. package/util/arrays.d.ts +13 -0
  135. package/util/assert.d.ts +1 -1
  136. package/util/mermaid/mermaid.js +17 -0
  137. package/util/version.js +1 -1
@@ -15,7 +15,8 @@ import type { DEFAULT_DATAFLOW_PIPELINE } from '../core/steps/pipeline/default-p
15
15
  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
- export type Query = CallContextQuery | ConfigQuery | DataflowQuery | NormalizedAstQuery | IdMapQuery | DataflowClusterQuery | StaticSliceQuery | LineageQuery | DependenciesQuery | LocationMapQuery;
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
20
  export type QueryArgumentsWithType<QueryType extends BaseQueryFormat['type']> = Query & {
20
21
  type: QueryType;
21
22
  };
@@ -45,7 +46,7 @@ export declare const SupportedQueries: {
45
46
  readonly name: "parse";
46
47
  readonly humanReadableName: "parse with R shell";
47
48
  readonly description: "Parse the given R code into an AST";
48
- 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>>;
49
50
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
50
51
  readonly printer: {
51
52
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -53,16 +54,16 @@ export declare const SupportedQueries: {
53
54
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
54
55
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
55
56
  };
56
- 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;
57
58
  };
58
59
  readonly dependencies: readonly [];
59
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
60
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
60
61
  } | {
61
62
  readonly name: "normalize";
62
63
  readonly humanReadableName: "normalize";
63
64
  readonly description: "Normalize the AST to flowR's AST";
64
65
  readonly processor: (results: {
65
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
66
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
66
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>>;
67
68
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
68
69
  readonly printer: {
@@ -80,6 +81,7 @@ export declare const SupportedQueries: {
80
81
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
81
82
  }, input: {
82
83
  request?: import("../r-bridge/retriever").RParseRequests;
84
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
83
85
  }) => import("../dataflow/info").DataflowInformation;
84
86
  readonly requiredInput: {};
85
87
  readonly name: "dataflow";
@@ -102,7 +104,7 @@ export declare const SupportedQueries: {
102
104
  readonly name: "parse";
103
105
  readonly humanReadableName: "parse with R shell";
104
106
  readonly description: "Parse the given R code into an AST";
105
- 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>>;
106
108
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
107
109
  readonly printer: {
108
110
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -110,16 +112,16 @@ export declare const SupportedQueries: {
110
112
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
111
113
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
112
114
  };
113
- 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;
114
116
  };
115
117
  readonly dependencies: readonly [];
116
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
118
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
117
119
  } | {
118
120
  readonly name: "normalize";
119
121
  readonly humanReadableName: "normalize";
120
122
  readonly description: "Normalize the AST to flowR's AST";
121
123
  readonly processor: (results: {
122
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
124
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
123
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>>;
124
126
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
125
127
  readonly printer: {
@@ -137,6 +139,7 @@ export declare const SupportedQueries: {
137
139
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
138
140
  }, input: {
139
141
  request?: import("../r-bridge/retriever").RParseRequests;
142
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
140
143
  }) => import("../dataflow/info").DataflowInformation;
141
144
  readonly requiredInput: {};
142
145
  readonly name: "dataflow";
@@ -159,7 +162,7 @@ export declare const SupportedQueries: {
159
162
  readonly name: "parse";
160
163
  readonly humanReadableName: "parse with R shell";
161
164
  readonly description: "Parse the given R code into an AST";
162
- 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>>;
163
166
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
164
167
  readonly printer: {
165
168
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -167,16 +170,16 @@ export declare const SupportedQueries: {
167
170
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
168
171
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
169
172
  };
170
- 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;
171
174
  };
172
175
  readonly dependencies: readonly [];
173
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
176
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
174
177
  } | {
175
178
  readonly name: "normalize";
176
179
  readonly humanReadableName: "normalize";
177
180
  readonly description: "Normalize the AST to flowR's AST";
178
181
  readonly processor: (results: {
179
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
182
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
180
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>>;
181
184
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
182
185
  readonly printer: {
@@ -194,6 +197,7 @@ export declare const SupportedQueries: {
194
197
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
195
198
  }, input: {
196
199
  request?: import("../r-bridge/retriever").RParseRequests;
200
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
197
201
  }) => import("../dataflow/info").DataflowInformation;
198
202
  readonly requiredInput: {};
199
203
  readonly name: "dataflow";
@@ -216,7 +220,7 @@ export declare const SupportedQueries: {
216
220
  readonly name: "parse";
217
221
  readonly humanReadableName: "parse with R shell";
218
222
  readonly description: "Parse the given R code into an AST";
219
- 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>>;
220
224
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
221
225
  readonly printer: {
222
226
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -224,16 +228,16 @@ export declare const SupportedQueries: {
224
228
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
225
229
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
226
230
  };
227
- 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;
228
232
  };
229
233
  readonly dependencies: readonly [];
230
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
234
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
231
235
  } | {
232
236
  readonly name: "normalize";
233
237
  readonly humanReadableName: "normalize";
234
238
  readonly description: "Normalize the AST to flowR's AST";
235
239
  readonly processor: (results: {
236
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
240
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
237
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>>;
238
242
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
239
243
  readonly printer: {
@@ -251,6 +255,7 @@ export declare const SupportedQueries: {
251
255
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
252
256
  }, input: {
253
257
  request?: import("../r-bridge/retriever").RParseRequests;
258
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
254
259
  }) => import("../dataflow/info").DataflowInformation;
255
260
  readonly requiredInput: {};
256
261
  readonly name: "dataflow";
@@ -273,7 +278,7 @@ export declare const SupportedQueries: {
273
278
  readonly name: "parse";
274
279
  readonly humanReadableName: "parse with R shell";
275
280
  readonly description: "Parse the given R code into an AST";
276
- 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>>;
277
282
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
278
283
  readonly printer: {
279
284
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -281,16 +286,16 @@ export declare const SupportedQueries: {
281
286
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
282
287
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
283
288
  };
284
- 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;
285
290
  };
286
291
  readonly dependencies: readonly [];
287
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
292
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
288
293
  } | {
289
294
  readonly name: "normalize";
290
295
  readonly humanReadableName: "normalize";
291
296
  readonly description: "Normalize the AST to flowR's AST";
292
297
  readonly processor: (results: {
293
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
298
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
294
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>>;
295
300
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
296
301
  readonly printer: {
@@ -308,6 +313,7 @@ export declare const SupportedQueries: {
308
313
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
309
314
  }, input: {
310
315
  request?: import("../r-bridge/retriever").RParseRequests;
316
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
311
317
  }) => import("../dataflow/info").DataflowInformation;
312
318
  readonly requiredInput: {};
313
319
  readonly name: "dataflow";
@@ -330,7 +336,7 @@ export declare const SupportedQueries: {
330
336
  readonly name: "parse";
331
337
  readonly humanReadableName: "parse with R shell";
332
338
  readonly description: "Parse the given R code into an AST";
333
- 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>>;
334
340
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
335
341
  readonly printer: {
336
342
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -338,16 +344,16 @@ export declare const SupportedQueries: {
338
344
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
339
345
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
340
346
  };
341
- 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;
342
348
  };
343
349
  readonly dependencies: readonly [];
344
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
350
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
345
351
  } | {
346
352
  readonly name: "normalize";
347
353
  readonly humanReadableName: "normalize";
348
354
  readonly description: "Normalize the AST to flowR's AST";
349
355
  readonly processor: (results: {
350
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
356
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
351
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>>;
352
358
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
353
359
  readonly printer: {
@@ -365,6 +371,7 @@ export declare const SupportedQueries: {
365
371
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
366
372
  }, input: {
367
373
  request?: import("../r-bridge/retriever").RParseRequests;
374
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
368
375
  }) => import("../dataflow/info").DataflowInformation;
369
376
  readonly requiredInput: {};
370
377
  readonly name: "dataflow";
@@ -387,7 +394,7 @@ export declare const SupportedQueries: {
387
394
  readonly name: "parse";
388
395
  readonly humanReadableName: "parse with R shell";
389
396
  readonly description: "Parse the given R code into an AST";
390
- 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>>;
391
398
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
392
399
  readonly printer: {
393
400
  readonly 0: typeof import("../core/print/print").internalPrinter;
@@ -395,16 +402,16 @@ export declare const SupportedQueries: {
395
402
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
396
403
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
397
404
  };
398
- 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;
399
406
  };
400
407
  readonly dependencies: readonly [];
401
- readonly requiredInput: import("../core/steps/all/core/00-parse").ParseRequiredInput;
408
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
402
409
  } | {
403
410
  readonly name: "normalize";
404
411
  readonly humanReadableName: "normalize";
405
412
  readonly description: "Normalize the AST to flowR's AST";
406
413
  readonly processor: (results: {
407
- parse?: import("../core/steps/all/core/00-parse").ParseStepOutput;
414
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
408
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>>;
409
416
  readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
410
417
  readonly printer: {
@@ -422,6 +429,7 @@ export declare const SupportedQueries: {
422
429
  normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
423
430
  }, input: {
424
431
  request?: import("../r-bridge/retriever").RParseRequests;
432
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
425
433
  }) => import("../dataflow/info").DataflowInformation;
426
434
  readonly requiredInput: {};
427
435
  readonly name: "dataflow";
@@ -443,6 +451,64 @@ export declare const SupportedQueries: {
443
451
  readonly asciiSummarizer: (formatter: OutputFormatter, _processed: unknown, queryResults: BaseQueryResult, result: string[]) => boolean;
444
452
  readonly schema: Joi.ObjectSchema<any>;
445
453
  };
454
+ readonly search: {
455
+ readonly executor: typeof import("./catalog/search-query/search-query-executor").executeSearch;
456
+ readonly asciiSummarizer: (formatter: OutputFormatter, _processed: PipelineOutput<import("../core/steps/pipeline/pipeline").Pipeline<{
457
+ readonly name: "parse";
458
+ readonly humanReadableName: "parse with R shell";
459
+ readonly description: "Parse the given R code into an AST";
460
+ readonly processor: (_results: unknown, input: Partial<import("../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../r-bridge/parser").ParseStepOutput<string>>;
461
+ readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
462
+ readonly printer: {
463
+ readonly 0: typeof import("../core/print/print").internalPrinter;
464
+ readonly 2: {
465
+ (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
466
+ (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
467
+ };
468
+ readonly 5: ({ parsed }: import("../r-bridge/parser").ParseStepOutput<string>, config: import("../util/quads").QuadSerializationConfiguration) => string;
469
+ };
470
+ readonly dependencies: readonly [];
471
+ readonly requiredInput: import("../r-bridge/parser").ParseRequiredInput<string>;
472
+ } | {
473
+ readonly name: "normalize";
474
+ readonly humanReadableName: "normalize";
475
+ readonly description: "Normalize the AST to flowR's AST";
476
+ readonly processor: (results: {
477
+ parse?: import("../r-bridge/parser").ParseStepOutput<string>;
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>>;
479
+ readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
480
+ readonly printer: {
481
+ readonly 0: typeof import("../core/print/print").internalPrinter;
482
+ readonly 2: typeof import("../core/print/normalize-printer").normalizedAstToJson;
483
+ readonly 5: typeof import("../core/print/normalize-printer").normalizedAstToQuads;
484
+ readonly 3: typeof import("../core/print/normalize-printer").printNormalizedAstToMermaid;
485
+ readonly 4: typeof import("../core/print/normalize-printer").printNormalizedAstToMermaidUrl;
486
+ };
487
+ readonly dependencies: readonly ["parse"];
488
+ readonly requiredInput: import("../core/steps/all/core/10-normalize").NormalizeRequiredInput;
489
+ } | {
490
+ readonly humanReadableName: "dataflow";
491
+ readonly processor: (results: {
492
+ normalize?: import("../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
493
+ }, input: {
494
+ request?: import("../r-bridge/retriever").RParseRequests;
495
+ parser?: import("../r-bridge/parser").Parser<import("../r-bridge/parser").KnownParserType>;
496
+ }) => import("../dataflow/info").DataflowInformation;
497
+ readonly requiredInput: {};
498
+ readonly name: "dataflow";
499
+ readonly description: "Construct the dataflow graph";
500
+ readonly executed: import("../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
501
+ readonly printer: {
502
+ readonly 0: typeof import("../core/print/print").internalPrinter;
503
+ readonly 2: typeof import("../core/print/dataflow-printer").dataflowGraphToJson;
504
+ readonly 5: typeof import("../core/print/dataflow-printer").dataflowGraphToQuads;
505
+ readonly 3: typeof import("../core/print/dataflow-printer").dataflowGraphToMermaid;
506
+ readonly 4: typeof import("../core/print/dataflow-printer").dataflowGraphToMermaidUrl;
507
+ };
508
+ readonly dependencies: readonly ["normalize"];
509
+ }>>, queryResults: BaseQueryResult, result: string[]) => true;
510
+ readonly schema: Joi.ObjectSchema<any>;
511
+ };
446
512
  };
447
513
  export type SupportedQueryTypes = keyof typeof SupportedQueries;
448
514
  export type QueryResult<Type extends Query['type']> = ReturnType<typeof SupportedQueries[Type]['executor']>;
package/queries/query.js CHANGED
@@ -23,6 +23,7 @@ const dependencies_query_format_1 = require("./catalog/dependencies-query/depend
23
23
  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
+ const search_query_format_1 = require("./catalog/search-query/search-query-format");
26
27
  exports.SupportedQueries = {
27
28
  'call-context': call_context_query_format_1.CallContextQueryDefinition,
28
29
  'config': config_query_format_1.ConfigQueryDefinition,
@@ -33,7 +34,8 @@ exports.SupportedQueries = {
33
34
  'static-slice': static_slice_query_format_1.StaticSliceQueryDefinition,
34
35
  'lineage': lineage_query_format_1.LineageQueryDefinition,
35
36
  'dependencies': dependencies_query_format_1.DependenciesQueryDefinition,
36
- 'location-map': location_map_query_format_1.LocationMapQueryDefinition
37
+ 'location-map': location_map_query_format_1.LocationMapQueryDefinition,
38
+ 'search': search_query_format_1.SearchQueryDefinition
37
39
  };
38
40
  function executeQueriesOfSameType(data, ...queries) {
39
41
  (0, assert_1.guard)(queries.length > 0, 'At least one query must be provided');
@@ -204,6 +204,10 @@ export declare enum RType {
204
204
  */
205
205
  Delimiter = "RDelimiter"
206
206
  }
207
+ export declare const ValidRTypes: Set<string>;
208
+ export declare const ValidRTypesReverse: {
209
+ [k: string]: string;
210
+ };
207
211
  /**
208
212
  * Validates, whether the given type can be used as a symbol in R
209
213
  *
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RType = exports.RawRType = void 0;
3
+ exports.ValidRTypesReverse = exports.ValidRTypes = exports.RType = exports.RawRType = void 0;
4
4
  exports.isSymbol = isSymbol;
5
5
  /**
6
6
  * Token types as they are produced by the R parser.
@@ -211,6 +211,8 @@ var RType;
211
211
  */
212
212
  RType["Delimiter"] = "RDelimiter";
213
213
  })(RType || (exports.RType = RType = {}));
214
+ exports.ValidRTypes = new Set(Object.values(RType));
215
+ exports.ValidRTypesReverse = Object.fromEntries(Object.entries(RType).map(([k, v]) => [v, k]));
214
216
  const validSymbolTypes = new Set([
215
217
  RawRType.Symbol,
216
218
  RawRType.SymbolPackage,
@@ -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;