@eagleoutice/flowr 2.2.1 → 2.2.3

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 (95) hide show
  1. package/cli/flowr.js +2 -1
  2. package/cli/repl/commands/repl-cfg.js +30 -7
  3. package/cli/repl/commands/repl-dataflow.js +29 -6
  4. package/cli/repl/commands/repl-normalize.js +22 -2
  5. package/cli/repl/commands/repl-parse.js +50 -3
  6. package/cli/repl/core.js +4 -0
  7. package/cli/repl/print-version.d.ts +1 -0
  8. package/cli/repl/print-version.js +7 -2
  9. package/cli/repl/server/connection.js +11 -9
  10. package/cli/script-core/statistics-helper-core.js +1 -1
  11. package/config.js +8 -1
  12. package/core/pipeline-executor.d.ts +6 -0
  13. package/core/pipeline-executor.js +8 -0
  14. package/core/print/dataflow-printer.js +3 -0
  15. package/core/steps/all/core/01-parse-tree-sitter.d.ts +7 -0
  16. package/core/steps/pipeline/default-pipelines.d.ts +57 -47
  17. package/core/steps/pipeline/default-pipelines.js +23 -2
  18. package/core/steps/pipeline/pipeline.d.ts +1 -1
  19. package/core/steps/pipeline/pipeline.js +1 -1
  20. package/core/steps/pipeline-step.d.ts +1 -3
  21. package/dataflow/environments/resolve-by-name.d.ts +3 -2
  22. package/dataflow/environments/resolve-by-name.js +4 -4
  23. package/dataflow/extractor.d.ts +10 -0
  24. package/dataflow/extractor.js +11 -1
  25. package/dataflow/graph/dataflowgraph-builder.d.ts +11 -10
  26. package/dataflow/graph/dataflowgraph-builder.js +11 -10
  27. package/dataflow/graph/edge.d.ts +1 -1
  28. package/dataflow/graph/edge.js +2 -2
  29. package/dataflow/graph/vertex.d.ts +6 -6
  30. package/dataflow/graph/vertex.js +5 -5
  31. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +9 -5
  32. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +1 -1
  33. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +22 -6
  34. package/documentation/doc-util/doc-cfg.js +2 -2
  35. package/documentation/doc-util/doc-dfg.d.ts +5 -3
  36. package/documentation/doc-util/doc-dfg.js +10 -8
  37. package/documentation/doc-util/doc-files.d.ts +1 -1
  38. package/documentation/doc-util/doc-files.js +1 -1
  39. package/documentation/doc-util/doc-normalized-ast.d.ts +2 -1
  40. package/documentation/doc-util/doc-normalized-ast.js +4 -5
  41. package/documentation/doc-util/doc-repl.d.ts +6 -2
  42. package/documentation/doc-util/doc-repl.js +10 -6
  43. package/documentation/doc-util/doc-structure.d.ts +1 -1
  44. package/documentation/doc-util/doc-types.d.ts +7 -5
  45. package/documentation/doc-util/doc-types.js +17 -12
  46. package/documentation/index.d.ts +9 -0
  47. package/documentation/index.js +26 -0
  48. package/documentation/print-capabilities-markdown.js +105 -19
  49. package/documentation/print-core-wiki.d.ts +1 -0
  50. package/documentation/print-core-wiki.js +406 -0
  51. package/documentation/print-dataflow-graph-wiki.js +27 -27
  52. package/documentation/print-interface-wiki.js +1 -3
  53. package/documentation/print-linting-and-testing-wiki.js +26 -8
  54. package/documentation/print-normalized-ast-wiki.js +22 -17
  55. package/documentation/print-query-wiki.js +37 -7
  56. package/documentation/print-search-wiki.js +2 -1
  57. package/package.json +10 -7
  58. package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
  59. package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
  60. package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
  61. package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -1
  62. package/queries/catalog/resolve-value-query/resolve-value-query-executor.d.ts +4 -0
  63. package/queries/catalog/resolve-value-query/resolve-value-query-executor.js +34 -0
  64. package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +72 -0
  65. package/queries/catalog/resolve-value-query/resolve-value-query-format.js +49 -0
  66. package/queries/catalog/search-query/search-query-format.js +1 -1
  67. package/queries/query.d.ts +60 -1
  68. package/queries/query.js +3 -1
  69. package/r-bridge/data/data.d.ts +50 -9
  70. package/r-bridge/data/data.js +64 -10
  71. package/r-bridge/data/types.d.ts +7 -1
  72. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +2 -0
  73. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +2 -5
  74. package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +6 -0
  75. package/r-bridge/lang-4.x/ast/parser/json/format.js +6 -0
  76. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +13 -2
  77. package/r-bridge/lang-4.x/ast/parser/json/parser.js +19 -3
  78. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.d.ts +3 -0
  79. package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +3 -0
  80. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +51 -29
  81. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-types.d.ts +4 -1
  82. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-types.js +3 -0
  83. package/r-bridge/parser.d.ts +10 -0
  84. package/r-bridge/parser.js +26 -2
  85. package/search/flowr-search-builder.d.ts +1 -2
  86. package/search/flowr-search-builder.js +1 -3
  87. package/util/cfg/cfg.d.ts +10 -1
  88. package/util/cfg/cfg.js +56 -2
  89. package/util/mermaid/dfg.d.ts +3 -0
  90. package/util/mermaid/dfg.js +24 -8
  91. package/util/range.d.ts +21 -0
  92. package/util/range.js +3 -0
  93. package/util/strings.d.ts +9 -0
  94. package/util/strings.js +14 -0
  95. package/util/version.js +1 -1
@@ -1,9 +1,11 @@
1
1
  /**
2
- * Contains the default pipeline for working with flowr
2
+ * Contains the default pipeline for working with flowR
3
3
  */
4
4
  import type { PipelineInput } from './pipeline';
5
5
  import type { KnownParser, Parser } from '../../../r-bridge/parser';
6
6
  import { PipelineExecutor } from '../../pipeline-executor';
7
+ import type { RShell } from '../../../r-bridge/shell';
8
+ import type { TreeSitterExecutor } from '../../../r-bridge/lang-4.x/tree-sitter/tree-sitter-executor';
7
9
  export declare const DEFAULT_SLICING_PIPELINE: import("./pipeline").Pipeline<{
8
10
  readonly name: "parse";
9
11
  readonly humanReadableName: "parse with R shell";
@@ -256,21 +258,6 @@ export declare const TREE_SITTER_SLICING_PIPELINE: import("./pipeline").Pipeline
256
258
  readonly 4: typeof import("../../print/dataflow-printer").dataflowGraphToMermaidUrl;
257
259
  };
258
260
  readonly dependencies: readonly ["normalize"];
259
- } | {
260
- readonly name: "parse";
261
- readonly humanReadableName: "parse with tree-sitter";
262
- readonly description: "Parse the given R code into an AST using tree-sitter";
263
- readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<import("web-tree-sitter").Tree>>;
264
- readonly executed: import("../pipeline-step").PipelineStepStage.OncePerFile;
265
- readonly printer: {
266
- readonly 0: typeof import("../../print/print").internalPrinter;
267
- readonly 2: {
268
- (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
269
- (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
270
- };
271
- };
272
- readonly dependencies: readonly [];
273
- readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>;
274
261
  } | {
275
262
  readonly name: "slice";
276
263
  readonly humanReadableName: "static slice";
@@ -299,6 +286,21 @@ export declare const TREE_SITTER_SLICING_PIPELINE: import("./pipeline").Pipeline
299
286
  };
300
287
  readonly dependencies: readonly ["slice"];
301
288
  readonly requiredInput: import("../all/static-slicing/10-reconstruct").ReconstructRequiredInput;
289
+ } | {
290
+ readonly name: "parse";
291
+ readonly humanReadableName: "parse with tree-sitter";
292
+ readonly description: "Parse the given R code into an AST using tree-sitter";
293
+ readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<import("web-tree-sitter").Tree>>;
294
+ readonly executed: import("../pipeline-step").PipelineStepStage.OncePerFile;
295
+ readonly printer: {
296
+ readonly 0: typeof import("../../print/print").internalPrinter;
297
+ readonly 2: {
298
+ (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
299
+ (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
300
+ };
301
+ };
302
+ readonly dependencies: readonly [];
303
+ readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>;
302
304
  } | {
303
305
  readonly name: "normalize";
304
306
  readonly humanReadableName: "normalize tree-sitter tree";
@@ -337,21 +339,6 @@ export declare const TREE_SITTER_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipel
337
339
  readonly 4: typeof import("../../print/dataflow-printer").dataflowGraphToMermaidUrl;
338
340
  };
339
341
  readonly dependencies: readonly ["normalize"];
340
- } | {
341
- readonly name: "parse";
342
- readonly humanReadableName: "parse with tree-sitter";
343
- readonly description: "Parse the given R code into an AST using tree-sitter";
344
- readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<import("web-tree-sitter").Tree>>;
345
- readonly executed: import("../pipeline-step").PipelineStepStage.OncePerFile;
346
- readonly printer: {
347
- readonly 0: typeof import("../../print/print").internalPrinter;
348
- readonly 2: {
349
- (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
350
- (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
351
- };
352
- };
353
- readonly dependencies: readonly [];
354
- readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>;
355
342
  } | {
356
343
  readonly name: "slice";
357
344
  readonly humanReadableName: "static slice";
@@ -380,6 +367,21 @@ export declare const TREE_SITTER_SLICE_AND_RECONSTRUCT_PIPELINE: import("./pipel
380
367
  };
381
368
  readonly dependencies: readonly ["slice"];
382
369
  readonly requiredInput: import("../all/static-slicing/10-reconstruct").ReconstructRequiredInput;
370
+ } | {
371
+ readonly name: "parse";
372
+ readonly humanReadableName: "parse with tree-sitter";
373
+ readonly description: "Parse the given R code into an AST using tree-sitter";
374
+ readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<import("web-tree-sitter").Tree>>;
375
+ readonly executed: import("../pipeline-step").PipelineStepStage.OncePerFile;
376
+ readonly printer: {
377
+ readonly 0: typeof import("../../print/print").internalPrinter;
378
+ readonly 2: {
379
+ (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
380
+ (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
381
+ };
382
+ };
383
+ readonly dependencies: readonly [];
384
+ readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>;
383
385
  } | {
384
386
  readonly name: "normalize";
385
387
  readonly humanReadableName: "normalize tree-sitter tree";
@@ -418,6 +420,20 @@ export declare const TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./p
418
420
  readonly 4: typeof import("../../print/dataflow-printer").dataflowGraphToMermaidUrl;
419
421
  };
420
422
  readonly dependencies: readonly ["normalize"];
423
+ } | {
424
+ readonly name: "slice";
425
+ readonly humanReadableName: "static slice";
426
+ readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
427
+ readonly processor: (results: {
428
+ dataflow?: import("../../../dataflow/info").DataflowInformation;
429
+ normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
430
+ }, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
431
+ readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
432
+ readonly printer: {
433
+ readonly 0: typeof import("../../print/print").internalPrinter;
434
+ };
435
+ readonly dependencies: readonly ["dataflow"];
436
+ readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
421
437
  } | {
422
438
  readonly name: "parse";
423
439
  readonly humanReadableName: "parse with tree-sitter";
@@ -433,20 +449,6 @@ export declare const TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./p
433
449
  };
434
450
  readonly dependencies: readonly [];
435
451
  readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>;
436
- } | {
437
- readonly name: "slice";
438
- readonly humanReadableName: "static slice";
439
- readonly description: "Calculate the actual static slice from the dataflow graph and the given slicing criteria";
440
- readonly processor: (results: {
441
- dataflow?: import("../../../dataflow/info").DataflowInformation;
442
- normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
443
- }, input: Partial<import("../all/static-slicing/00-slice").SliceRequiredInput>) => Readonly<import("../../../slicing/static/slicer-types").SliceResult>;
444
- readonly executed: import("../pipeline-step").PipelineStepStage.OncePerRequest;
445
- readonly printer: {
446
- readonly 0: typeof import("../../print/print").internalPrinter;
447
- };
448
- readonly dependencies: readonly ["dataflow"];
449
- readonly requiredInput: import("../all/static-slicing/00-slice").SliceRequiredInput;
450
452
  } | {
451
453
  readonly name: "normalize";
452
454
  readonly humanReadableName: "normalize tree-sitter tree";
@@ -466,8 +468,8 @@ export declare const TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE: import("./p
466
468
  readonly requiredInput: import("../all/core/10-normalize").NormalizeRequiredInput;
467
469
  }>;
468
470
  /**
469
- * The default pipeline for working with flowr, including the dataflow step,
470
- * see the {@link DEFAULT_NORMALIZE_PIPELINE} for the pipeline without the dataflow step,
471
+ * The default pipeline for working with flowR, including the dataflow step.
472
+ * See the {@link DEFAULT_NORMALIZE_PIPELINE} for the pipeline without the dataflow step
471
473
  * and the {@link DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE} for the pipeline with slicing and reconstructing steps
472
474
  */
473
475
  export declare const DEFAULT_DATAFLOW_PIPELINE: import("./pipeline").Pipeline<{
@@ -678,7 +680,15 @@ export declare const TREE_SITTER_PARSE_PIPELINE: import("./pipeline").Pipeline<{
678
680
  readonly dependencies: readonly [];
679
681
  readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<import("web-tree-sitter").Tree>;
680
682
  }>;
683
+ export declare function createParsePipeline(parser: TreeSitterExecutor, inputs: Omit<PipelineInput<typeof DEFAULT_PARSE_PIPELINE>, 'parser'>): PipelineExecutor<typeof TREE_SITTER_PARSE_PIPELINE>;
684
+ export declare function createParsePipeline(parser: RShell, inputs: Omit<PipelineInput<typeof DEFAULT_PARSE_PIPELINE>, 'parser'>): PipelineExecutor<typeof DEFAULT_PARSE_PIPELINE>;
681
685
  export declare function createParsePipeline(parser: KnownParser, inputs: Omit<PipelineInput<typeof DEFAULT_PARSE_PIPELINE>, 'parser'>): PipelineExecutor<typeof DEFAULT_PARSE_PIPELINE> | PipelineExecutor<typeof TREE_SITTER_PARSE_PIPELINE>;
686
+ export declare function createSlicePipeline(parser: TreeSitterExecutor, inputs: Omit<PipelineInput<typeof DEFAULT_SLICING_PIPELINE>, 'parser'>): PipelineExecutor<typeof TREE_SITTER_SLICING_PIPELINE>;
687
+ export declare function createSlicePipeline(parser: RShell, inputs: Omit<PipelineInput<typeof DEFAULT_SLICING_PIPELINE>, 'parser'>): PipelineExecutor<typeof DEFAULT_SLICING_PIPELINE>;
682
688
  export declare function createSlicePipeline(parser: KnownParser, inputs: Omit<PipelineInput<typeof DEFAULT_SLICING_PIPELINE>, 'parser'>): PipelineExecutor<typeof DEFAULT_SLICING_PIPELINE> | PipelineExecutor<typeof TREE_SITTER_SLICING_PIPELINE>;
689
+ export declare function createNormalizePipeline(parser: TreeSitterExecutor, inputs: Omit<PipelineInput<typeof DEFAULT_NORMALIZE_PIPELINE>, 'parser'>): PipelineExecutor<typeof TREE_SITTER_NORMALIZE_PIPELINE>;
690
+ export declare function createNormalizePipeline(parser: RShell, inputs: Omit<PipelineInput<typeof DEFAULT_NORMALIZE_PIPELINE>, 'parser'>): PipelineExecutor<typeof DEFAULT_NORMALIZE_PIPELINE>;
683
691
  export declare function createNormalizePipeline(parser: KnownParser, inputs: Omit<PipelineInput<typeof DEFAULT_NORMALIZE_PIPELINE>, 'parser'>): PipelineExecutor<typeof DEFAULT_NORMALIZE_PIPELINE> | PipelineExecutor<typeof TREE_SITTER_NORMALIZE_PIPELINE>;
692
+ export declare function createDataflowPipeline(parser: TreeSitterExecutor, inputs: Omit<PipelineInput<typeof DEFAULT_DATAFLOW_PIPELINE>, 'parser'>): PipelineExecutor<typeof TREE_SITTER_DATAFLOW_PIPELINE>;
693
+ export declare function createDataflowPipeline(parser: RShell, inputs: Omit<PipelineInput<typeof DEFAULT_DATAFLOW_PIPELINE>, 'parser'>): PipelineExecutor<typeof DEFAULT_DATAFLOW_PIPELINE>;
684
694
  export declare function createDataflowPipeline(parser: KnownParser, inputs: Omit<PipelineInput<typeof DEFAULT_DATAFLOW_PIPELINE>, 'parser'>): PipelineExecutor<typeof DEFAULT_DATAFLOW_PIPELINE> | PipelineExecutor<typeof TREE_SITTER_DATAFLOW_PIPELINE>;
@@ -21,8 +21,8 @@ exports.TREE_SITTER_SLICING_PIPELINE = (0, pipeline_1.createPipeline)(_01_parse_
21
21
  exports.TREE_SITTER_SLICE_AND_RECONSTRUCT_PIPELINE = exports.TREE_SITTER_SLICING_PIPELINE;
22
22
  exports.TREE_SITTER_SLICE_WITHOUT_RECONSTRUCT_PIPELINE = (0, pipeline_1.createPipeline)(_01_parse_tree_sitter_1.PARSE_WITH_TREE_SITTER_STEP, _11_normalize_tree_sitter_1.NORMALIZE_TREE_SITTER, _20_dataflow_1.STATIC_DATAFLOW, _00_slice_1.STATIC_SLICE);
23
23
  /**
24
- * The default pipeline for working with flowr, including the dataflow step,
25
- * see the {@link DEFAULT_NORMALIZE_PIPELINE} for the pipeline without the dataflow step,
24
+ * The default pipeline for working with flowR, including the dataflow step.
25
+ * See the {@link DEFAULT_NORMALIZE_PIPELINE} for the pipeline without the dataflow step
26
26
  * and the {@link DEFAULT_SLICE_AND_RECONSTRUCT_PIPELINE} for the pipeline with slicing and reconstructing steps
27
27
  */
28
28
  exports.DEFAULT_DATAFLOW_PIPELINE = (0, pipeline_1.createPipeline)(_00_parse_1.PARSE_WITH_R_SHELL_STEP, _10_normalize_1.NORMALIZE, _20_dataflow_1.STATIC_DATAFLOW);
@@ -32,6 +32,11 @@ exports.DEFAULT_NORMALIZE_PIPELINE = (0, pipeline_1.createPipeline)(_00_parse_1.
32
32
  exports.TREE_SITTER_NORMALIZE_PIPELINE = (0, pipeline_1.createPipeline)(_01_parse_tree_sitter_1.PARSE_WITH_TREE_SITTER_STEP, _11_normalize_tree_sitter_1.NORMALIZE_TREE_SITTER);
33
33
  exports.DEFAULT_PARSE_PIPELINE = (0, pipeline_1.createPipeline)(_00_parse_1.PARSE_WITH_R_SHELL_STEP);
34
34
  exports.TREE_SITTER_PARSE_PIPELINE = (0, pipeline_1.createPipeline)(_01_parse_tree_sitter_1.PARSE_WITH_TREE_SITTER_STEP);
35
+ /**
36
+ * Returns either a {@link DEFAULT_PARSE_PIPELINE} or a {@link TREE_SITTER_PARSE_PIPELINE} depending on the parser used.
37
+ *
38
+ * @see {@link createNormalizePipeline}, {@link createDataflowPipeline}, {@link createSlicePipeline}
39
+ */
35
40
  function createParsePipeline(parser, inputs) {
36
41
  const base = parser.name === 'tree-sitter' ? exports.TREE_SITTER_PARSE_PIPELINE : exports.DEFAULT_PARSE_PIPELINE;
37
42
  return new pipeline_executor_1.PipelineExecutor(base, {
@@ -39,6 +44,11 @@ function createParsePipeline(parser, inputs) {
39
44
  ...inputs
40
45
  });
41
46
  }
47
+ /**
48
+ * Returns either a {@link DEFAULT_SLICING_PIPELINE} or a {@link TREE_SITTER_SLICING_PIPELINE} depending on the parser used.
49
+ *
50
+ * @see {@link createParsePipeline}, {@link createNormalizePipeline}, {@link createDataflowPipeline}
51
+ */
42
52
  function createSlicePipeline(parser, inputs) {
43
53
  const base = parser.name === 'tree-sitter' ? exports.TREE_SITTER_SLICING_PIPELINE : exports.DEFAULT_SLICING_PIPELINE;
44
54
  return new pipeline_executor_1.PipelineExecutor(base, {
@@ -46,6 +56,11 @@ function createSlicePipeline(parser, inputs) {
46
56
  ...inputs
47
57
  });
48
58
  }
59
+ /**
60
+ * Returns either a {@link DEFAULT_NORMALIZE_PIPELINE} or a {@link TREE_SITTER_NORMALIZE_PIPELINE} depending on the parser used.
61
+ *
62
+ * @see {@link createParsePipeline}, {@link createDataflowPipeline}, {@link createSlicePipeline}
63
+ */
49
64
  function createNormalizePipeline(parser, inputs) {
50
65
  const base = parser.name === 'tree-sitter' ? exports.TREE_SITTER_NORMALIZE_PIPELINE : exports.DEFAULT_NORMALIZE_PIPELINE;
51
66
  return new pipeline_executor_1.PipelineExecutor(base, {
@@ -53,6 +68,12 @@ function createNormalizePipeline(parser, inputs) {
53
68
  ...inputs
54
69
  });
55
70
  }
71
+ /**
72
+ * Returns either a {@link DEFAULT_DATAFLOW_PIPELINE} or a {@link TREE_SITTER_DATAFLOW_PIPELINE} depending on the parser used.
73
+ *
74
+ * @see {@link createParsePipeline}, {@link createNormalizePipeline}, {@link createSlicePipeline}
75
+ *
76
+ */
56
77
  function createDataflowPipeline(parser, inputs) {
57
78
  const base = parser.name === 'tree-sitter' ? exports.TREE_SITTER_DATAFLOW_PIPELINE : exports.DEFAULT_DATAFLOW_PIPELINE;
58
79
  return new pipeline_executor_1.PipelineExecutor(base, {
@@ -120,7 +120,7 @@ export type PipelineOutput<P extends Pipeline> = {
120
120
  *
121
121
  * 0) the collection of {@link IPipelineStep|steps} is not empty
122
122
  * 1) all {@link IPipelineStepOrder#name|names} of {@link IPipelineStep|steps} are unique for the given pipeline
123
- * 2) all {@link IPipelineStepOrder#dependencies|dependencies} of all {@link IPipelineStep|steps} are exist
123
+ * 2) all {@link IPipelineStepOrder#dependencies|dependencies} of all {@link IPipelineStep|steps} exist
124
124
  * 3) there are no cycles in the dependency graph
125
125
  * 4) the target of a {@link IPipelineStepOrder#decorates|step's decoration} exists
126
126
  * 5) if a {@link IPipelineStepOrder#decorates|decoration} applies, all of its {@link IPipelineStepOrder#dependencies|dependencies} are already in the pipeline
@@ -9,7 +9,7 @@ const create_pipeline_1 = require("./create-pipeline");
9
9
  *
10
10
  * 0) the collection of {@link IPipelineStep|steps} is not empty
11
11
  * 1) all {@link IPipelineStepOrder#name|names} of {@link IPipelineStep|steps} are unique for the given pipeline
12
- * 2) all {@link IPipelineStepOrder#dependencies|dependencies} of all {@link IPipelineStep|steps} are exist
12
+ * 2) all {@link IPipelineStepOrder#dependencies|dependencies} of all {@link IPipelineStep|steps} exist
13
13
  * 3) there are no cycles in the dependency graph
14
14
  * 4) the target of a {@link IPipelineStepOrder#decorates|step's decoration} exists
15
15
  * 5) if a {@link IPipelineStepOrder#decorates|decoration} applies, all of its {@link IPipelineStepOrder#dependencies|dependencies} are already in the pipeline
@@ -67,9 +67,7 @@ export interface IPipelineStep<Name extends PipelineStepName = PipelineStepName,
67
67
  readonly description: string;
68
68
  /** The main processor that essentially performs the logic of this step */
69
69
  readonly processor: (...input: Parameters<Fn>) => ReturnType<Fn>;
70
- /**
71
- * How to visualize the results of the respective step to the user?
72
- */
70
+ /** How to visualize the results of the respective step to the user? */
73
71
  readonly printer: {
74
72
  [K in StepOutputFormat]?: IPipelineStepPrinter<Fn, K, never[]>;
75
73
  } & {
@@ -4,6 +4,7 @@ import type { Identifier, IdentifierDefinition } from './identifier';
4
4
  import { ReferenceType } from './identifier';
5
5
  import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
6
6
  import type { DataflowGraph } from '../graph/graph';
7
+ import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
7
8
  /**
8
9
  * Resolves a given identifier name to a list of its possible definition location using R scoping and resolving rules.
9
10
  *
@@ -18,9 +19,9 @@ export declare function resolveByName(name: Identifier, environment: REnvironmen
18
19
  export declare function resolvesToBuiltInConstant(name: Identifier | undefined, environment: REnvironmentInformation, wantedValue: unknown): Ternary;
19
20
  export declare function resolveToConstants(name: Identifier | undefined, environment: REnvironmentInformation): unknown[] | undefined;
20
21
  export declare function getAliases(sourceIds: readonly NodeId[], dataflow: DataflowGraph, environment: REnvironmentInformation): NodeId[] | undefined;
21
- export declare function resolveToValues(identifier: Identifier | undefined, environment: REnvironmentInformation, graph: DataflowGraph): unknown[] | undefined;
22
+ export declare function resolveToValues(identifier: Identifier | undefined, environment: REnvironmentInformation, idMap?: AstIdMap): unknown[] | undefined;
22
23
  /**
23
24
  * Convenience function using the variable resolver as specified within the configuration file
24
25
  * In the future we may want to have this set once at the start of the analysis
25
26
  */
26
- export declare function resolveValueOfVariable(identifier: Identifier | undefined, environment: REnvironmentInformation, graph: DataflowGraph): unknown[] | undefined;
27
+ export declare function resolveValueOfVariable(identifier: Identifier | undefined, environment: REnvironmentInformation, idMap?: AstIdMap): unknown[] | undefined;
@@ -147,7 +147,7 @@ function getAliases(sourceIds, dataflow, environment) {
147
147
  }
148
148
  return [...definitions];
149
149
  }
150
- function resolveToValues(identifier, environment, graph) {
150
+ function resolveToValues(identifier, environment, idMap) {
151
151
  if (identifier === undefined) {
152
152
  return undefined;
153
153
  }
@@ -169,7 +169,7 @@ function resolveToValues(identifier, environment, graph) {
169
169
  return undefined;
170
170
  }
171
171
  for (const id of def.value) {
172
- const value = graph.idMap?.get(id)?.content;
172
+ const value = idMap?.get(id)?.content;
173
173
  if (value !== undefined) {
174
174
  values.push(value);
175
175
  }
@@ -185,10 +185,10 @@ function resolveToValues(identifier, environment, graph) {
185
185
  * Convenience function using the variable resolver as specified within the configuration file
186
186
  * In the future we may want to have this set once at the start of the analysis
187
187
  */
188
- function resolveValueOfVariable(identifier, environment, graph) {
188
+ function resolveValueOfVariable(identifier, environment, idMap) {
189
189
  const resolve = (0, config_1.getConfig)().solver.variables;
190
190
  switch (resolve) {
191
- case config_1.VariableResolve.Alias: return resolveToValues(identifier, environment, graph);
191
+ case config_1.VariableResolve.Alias: return resolveToValues(identifier, environment, idMap);
192
192
  case config_1.VariableResolve.Builtin: return resolveToConstants(identifier, environment);
193
193
  case config_1.VariableResolve.Disabled: return [];
194
194
  default: (0, assert_1.assertUnreachable)(resolve);
@@ -3,5 +3,15 @@ import type { DataflowProcessors } from './processor';
3
3
  import type { NormalizedAst, ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
4
4
  import type { RParseRequests } from '../r-bridge/retriever';
5
5
  import type { KnownParserType, Parser } from '../r-bridge/parser';
6
+ /**
7
+ * The best friend of {@link produceDataFlowGraph} and {@link processDataflowFor}.
8
+ * Maps every {@link RType} in the normalized AST to a processor.
9
+ */
6
10
  export declare const processors: DataflowProcessors<ParentInformation>;
11
+ /**
12
+ * This is the main function to produce the dataflow graph from a given request and normalized AST.
13
+ * Note, that this requires knowledge of the active parser in case the dataflow analysis uncovers other files that have to be parsed and integrated into the analysis
14
+ * (e.g., in the event of a `source` call).
15
+ * For the actual, canonical fold entry point, see {@link processDataflowFor}.
16
+ */
7
17
  export declare function produceDataFlowGraph<OtherInfo>(parser: Parser<KnownParserType>, request: RParseRequests, ast: NormalizedAst<OtherInfo & ParentInformation>): DataflowInformation;
@@ -21,6 +21,10 @@ const cfg_1 = require("../util/cfg/cfg");
21
21
  const edge_1 = require("./graph/edge");
22
22
  const identify_link_to_last_call_relation_1 = require("../queries/catalog/call-context-query/identify-link-to-last-call-relation");
23
23
  const built_in_function_definition_1 = require("./internal/process/functions/call/built-in/built-in-function-definition");
24
+ /**
25
+ * The best friend of {@link produceDataFlowGraph} and {@link processDataflowFor}.
26
+ * Maps every {@link RType} in the normalized AST to a processor.
27
+ */
24
28
  exports.processors = {
25
29
  [type_1.RType.Number]: process_value_1.processValue,
26
30
  [type_1.RType.String]: process_value_1.processValue,
@@ -57,7 +61,7 @@ function resolveLinkToSideEffects(ast, graph) {
57
61
  if (typeof s !== 'object') {
58
62
  continue;
59
63
  }
60
- cfg ??= (0, cfg_1.extractCFG)(ast).graph;
64
+ cfg ??= (0, cfg_1.extractCFG)(ast, graph).graph;
61
65
  /* this has to change whenever we add a new link to relations because we currently offer no abstraction for the type */
62
66
  const potentials = (0, identify_link_to_last_call_relation_1.identifyLinkToLastCallRelation)(s.id, cfg, graph, s.linkTo);
63
67
  for (const pot of potentials) {
@@ -68,6 +72,12 @@ function resolveLinkToSideEffects(ast, graph) {
68
72
  }
69
73
  }
70
74
  }
75
+ /**
76
+ * This is the main function to produce the dataflow graph from a given request and normalized AST.
77
+ * Note, that this requires knowledge of the active parser in case the dataflow analysis uncovers other files that have to be parsed and integrated into the analysis
78
+ * (e.g., in the event of a `source` call).
79
+ * For the actual, canonical fold entry point, see {@link processDataflowFor}.
80
+ */
71
81
  function produceDataFlowGraph(parser, request, ast) {
72
82
  const multifile = Array.isArray(request);
73
83
  let firstRequest;
@@ -85,57 +85,58 @@ export declare class DataflowGraphBuilder extends DataflowGraph {
85
85
  /**
86
86
  * Adds a **read edge** (E1).
87
87
  *
88
- * @param from - Vertex/NodeId
89
- * @param to - see from
88
+ * @param from - NodeId of the source vertex
89
+ * @param to - Either a single or multiple target ids.
90
+ * If you pass multiple this will construct a single edge for each of them.
90
91
  */
91
92
  reads(from: NodeId, to: DataflowGraphEdgeTarget): this;
92
93
  /**
93
94
  * Adds a **defined-by edge** (E2), with from as defined variable, and to
94
95
  * as a variable/function contributing to its definition.
95
96
  *
96
- * @see reads for parameters.
97
+ * @see {@link DataflowGraphBuilder#reads|reads} for parameters.
97
98
  */
98
99
  definedBy(from: NodeId, to: DataflowGraphEdgeTarget): this;
99
100
  /**
100
101
  * Adds a **call edge** (E5) with from as caller, and to as callee.
101
102
  *
102
- * @see reads for parameters.
103
+ * @see {@link DataflowGraphBuilder#reads|reads} for parameters.
103
104
  */
104
105
  calls(from: NodeId, to: DataflowGraphEdgeTarget): this;
105
106
  /**
106
107
  * Adds a **return edge** (E6) with from as function, and to as exit point.
107
108
  *
108
- * @see reads for parameters.
109
+ * @see {@link DataflowGraphBuilder#reads|reads} for parameters.
109
110
  */
110
111
  returns(from: NodeId, to: DataflowGraphEdgeTarget): this;
111
112
  /**
112
113
  * Adds a **defines-on-call edge** (E7) with from as variable, and to as its definition
113
114
  *
114
- * @see reads for parameters.
115
+ * @see {@link DataflowGraphBuilder#reads|reads} for parameters.
115
116
  */
116
117
  definesOnCall(from: NodeId, to: DataflowGraphEdgeTarget): this;
117
118
  /**
118
119
  * Adds a **defined-by-on-call edge** with from as definition, and to as variable.
119
120
  *
120
- * @see reads for parameters.
121
+ * @see {@link DataflowGraphBuilder#reads|reads} for parameters.
121
122
  */
122
123
  definedByOnCall(from: NodeId, to: DataflowGraphEdgeTarget): this;
123
124
  /**
124
125
  * Adds an **argument edge** (E9) with from as function call, and to as argument.
125
126
  *
126
- * @see reads for parameters.
127
+ * @see {@link DataflowGraphBuilder#reads|reads} for parameters.
127
128
  */
128
129
  argument(from: NodeId, to: DataflowGraphEdgeTarget): this;
129
130
  /**
130
131
  * Adds a **non-standard evaluation edge** with from as vertex, and to as vertex.
131
132
  *
132
- * @see reads for parameters.
133
+ * @see {@link DataflowGraphBuilder#reads|reads} for parameters.
133
134
  */
134
135
  nse(from: NodeId, to: DataflowGraphEdgeTarget): this;
135
136
  /**
136
137
  * Adds a **side-effect-on-call edge** with from as vertex, and to as vertex.
137
138
  *
138
- * @see reads for parameters.
139
+ * @see {@link DataflowGraphBuilder#reads|reads} for parameters.
139
140
  */
140
141
  sideEffectOnCall(from: NodeId, to: DataflowGraphEdgeTarget): this;
141
142
  /**
@@ -173,8 +173,9 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
173
173
  /**
174
174
  * Adds a **read edge** (E1).
175
175
  *
176
- * @param from - Vertex/NodeId
177
- * @param to - see from
176
+ * @param from - NodeId of the source vertex
177
+ * @param to - Either a single or multiple target ids.
178
+ * If you pass multiple this will construct a single edge for each of them.
178
179
  */
179
180
  reads(from, to) {
180
181
  return this.edgeHelper(from, to, edge_1.EdgeType.Reads);
@@ -183,7 +184,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
183
184
  * Adds a **defined-by edge** (E2), with from as defined variable, and to
184
185
  * as a variable/function contributing to its definition.
185
186
  *
186
- * @see reads for parameters.
187
+ * @see {@link DataflowGraphBuilder#reads|reads} for parameters.
187
188
  */
188
189
  definedBy(from, to) {
189
190
  return this.edgeHelper(from, to, edge_1.EdgeType.DefinedBy);
@@ -191,7 +192,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
191
192
  /**
192
193
  * Adds a **call edge** (E5) with from as caller, and to as callee.
193
194
  *
194
- * @see reads for parameters.
195
+ * @see {@link DataflowGraphBuilder#reads|reads} for parameters.
195
196
  */
196
197
  calls(from, to) {
197
198
  return this.edgeHelper(from, to, edge_1.EdgeType.Calls);
@@ -199,7 +200,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
199
200
  /**
200
201
  * Adds a **return edge** (E6) with from as function, and to as exit point.
201
202
  *
202
- * @see reads for parameters.
203
+ * @see {@link DataflowGraphBuilder#reads|reads} for parameters.
203
204
  */
204
205
  returns(from, to) {
205
206
  return this.edgeHelper(from, to, edge_1.EdgeType.Returns);
@@ -207,7 +208,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
207
208
  /**
208
209
  * Adds a **defines-on-call edge** (E7) with from as variable, and to as its definition
209
210
  *
210
- * @see reads for parameters.
211
+ * @see {@link DataflowGraphBuilder#reads|reads} for parameters.
211
212
  */
212
213
  definesOnCall(from, to) {
213
214
  return this.edgeHelper(from, to, edge_1.EdgeType.DefinesOnCall);
@@ -215,7 +216,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
215
216
  /**
216
217
  * Adds a **defined-by-on-call edge** with from as definition, and to as variable.
217
218
  *
218
- * @see reads for parameters.
219
+ * @see {@link DataflowGraphBuilder#reads|reads} for parameters.
219
220
  */
220
221
  definedByOnCall(from, to) {
221
222
  return this.edgeHelper(from, to, edge_1.EdgeType.DefinedByOnCall);
@@ -223,7 +224,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
223
224
  /**
224
225
  * Adds an **argument edge** (E9) with from as function call, and to as argument.
225
226
  *
226
- * @see reads for parameters.
227
+ * @see {@link DataflowGraphBuilder#reads|reads} for parameters.
227
228
  */
228
229
  argument(from, to) {
229
230
  return this.edgeHelper(from, to, edge_1.EdgeType.Argument);
@@ -231,7 +232,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
231
232
  /**
232
233
  * Adds a **non-standard evaluation edge** with from as vertex, and to as vertex.
233
234
  *
234
- * @see reads for parameters.
235
+ * @see {@link DataflowGraphBuilder#reads|reads} for parameters.
235
236
  */
236
237
  nse(from, to) {
237
238
  return this.edgeHelper(from, to, edge_1.EdgeType.NonStandardEvaluation);
@@ -239,7 +240,7 @@ class DataflowGraphBuilder extends graph_1.DataflowGraph {
239
240
  /**
240
241
  * Adds a **side-effect-on-call edge** with from as vertex, and to as vertex.
241
242
  *
242
- * @see reads for parameters.
243
+ * @see {@link DataflowGraphBuilder#reads|reads} for parameters.
243
244
  */
244
245
  sideEffectOnCall(from, to) {
245
246
  return this.edgeHelper(from, to, edge_1.EdgeType.SideEffectOnCall);
@@ -78,7 +78,7 @@ export declare const enum TraverseEdge {
78
78
  *
79
79
  * Counterpart of {@link edgeDoesNotIncludeType}.
80
80
  */
81
- export declare function edgeIncludesType(type: EdgeTypeBits, types: EdgeTypeBits): boolean;
81
+ export declare function edgeIncludesType(type: EdgeTypeBits, typesToInclude: EdgeTypeBits): boolean;
82
82
  /**
83
83
  * Check if the given-edge type does not include the given type.
84
84
  * Counterpart of {@link edgeIncludesType}.
@@ -85,8 +85,8 @@ function edgeTypesToNames(bits) {
85
85
  *
86
86
  * Counterpart of {@link edgeDoesNotIncludeType}.
87
87
  */
88
- function edgeIncludesType(type, types) {
89
- return (types & type) !== 0;
88
+ function edgeIncludesType(type, typesToInclude) {
89
+ return (typesToInclude & type) !== 0;
90
90
  }
91
91
  /**
92
92
  * Check if the given-edge type does not include the given type.
@@ -21,7 +21,7 @@ export declare const ValidVertexTypeReverse: {
21
21
  */
22
22
  export interface ContainerLeafIndex {
23
23
  /**
24
- * Destinctive lexeme of index e.g 'name' for `list(name = 'John')`
24
+ * Distinctive lexeme of index e.g. 'name' for `list(name = 'John')`
25
25
  */
26
26
  readonly lexeme: string;
27
27
  /**
@@ -201,21 +201,21 @@ export type DataflowGraphVertices<Vertex extends DataflowGraphVertexInfo = Dataf
201
201
  /**
202
202
  * Check if the given vertex is a {@link DataflowGraphVertexValue|value vertex}.
203
203
  */
204
- export declare function isValueVertex(vertex: DataflowGraphVertexBase): vertex is DataflowGraphVertexValue;
204
+ export declare function isValueVertex(vertex?: DataflowGraphVertexBase): vertex is DataflowGraphVertexValue;
205
205
  /**
206
206
  * Check if the given vertex is a {@link DataflowGraphVertexUse|use vertex}.
207
207
  */
208
- export declare function isUseVertex(vertex: DataflowGraphVertexBase): vertex is DataflowGraphVertexUse;
208
+ export declare function isUseVertex(vertex?: DataflowGraphVertexBase): vertex is DataflowGraphVertexUse;
209
209
  /**
210
210
  * Check if the given vertex is a {@link DataflowGraphVertexFunctionCall|function call vertex}.
211
211
  */
212
- export declare function isFunctionCallVertex(vertex: DataflowGraphVertexBase): vertex is DataflowGraphVertexFunctionCall;
212
+ export declare function isFunctionCallVertex(vertex?: DataflowGraphVertexBase): vertex is DataflowGraphVertexFunctionCall;
213
213
  /**
214
214
  * Check if the given vertex is a {@link DataflowGraphVertexVariableDefinition|variable definition vertex}.
215
215
  */
216
- export declare function isVariableDefinitionVertex(vertex: DataflowGraphVertexBase): vertex is DataflowGraphVertexVariableDefinition;
216
+ export declare function isVariableDefinitionVertex(vertex?: DataflowGraphVertexBase): vertex is DataflowGraphVertexVariableDefinition;
217
217
  /**
218
218
  * Check if the given vertex is a {@link DataflowGraphVertexFunctionDefinition|function definition vertex}.
219
219
  */
220
- export declare function isFunctionDefinitionVertex(vertex: DataflowGraphVertexBase): vertex is DataflowGraphVertexFunctionDefinition;
220
+ export declare function isFunctionDefinitionVertex(vertex?: DataflowGraphVertexBase): vertex is DataflowGraphVertexFunctionDefinition;
221
221
  export {};
@@ -24,30 +24,30 @@ function isParentContainerIndex(index) {
24
24
  * Check if the given vertex is a {@link DataflowGraphVertexValue|value vertex}.
25
25
  */
26
26
  function isValueVertex(vertex) {
27
- return vertex.tag === VertexType.Value;
27
+ return vertex?.tag === VertexType.Value;
28
28
  }
29
29
  /**
30
30
  * Check if the given vertex is a {@link DataflowGraphVertexUse|use vertex}.
31
31
  */
32
32
  function isUseVertex(vertex) {
33
- return vertex.tag === VertexType.Use;
33
+ return vertex?.tag === VertexType.Use;
34
34
  }
35
35
  /**
36
36
  * Check if the given vertex is a {@link DataflowGraphVertexFunctionCall|function call vertex}.
37
37
  */
38
38
  function isFunctionCallVertex(vertex) {
39
- return vertex.tag === VertexType.FunctionCall;
39
+ return vertex?.tag === VertexType.FunctionCall;
40
40
  }
41
41
  /**
42
42
  * Check if the given vertex is a {@link DataflowGraphVertexVariableDefinition|variable definition vertex}.
43
43
  */
44
44
  function isVariableDefinitionVertex(vertex) {
45
- return vertex.tag === VertexType.VariableDefinition;
45
+ return vertex?.tag === VertexType.VariableDefinition;
46
46
  }
47
47
  /**
48
48
  * Check if the given vertex is a {@link DataflowGraphVertexFunctionDefinition|function definition vertex}.
49
49
  */
50
50
  function isFunctionDefinitionVertex(vertex) {
51
- return vertex.tag === VertexType.FunctionDefinition;
51
+ return vertex?.tag === VertexType.FunctionDefinition;
52
52
  }
53
53
  //# sourceMappingURL=vertex.js.map