@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eagleoutice/flowr",
3
- "version": "2.1.12",
3
+ "version": "2.2.1",
4
4
  "description": "Static Dataflow Analyzer and Program Slicer for the R Programming Language",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "repository": {
@@ -21,18 +21,21 @@
21
21
  "stats-helper": "ts-node src/cli/statistics-helper-app.ts",
22
22
  "slicer": "ts-node src/cli/slicer-app.ts",
23
23
  "benchmark-helper": "ts-node src/cli/benchmark-helper-app.ts",
24
- "benchmark": "npm run build && node dist/src/cli/benchmark-app.js",
24
+ "benchmark": "npm run build && npm run build:copy-wasm && node dist/src/cli/benchmark-app.js",
25
25
  "summarizer": "ts-node src/cli/summarizer-app.ts",
26
26
  "export-quads": "ts-node src/cli/export-quads-app.ts",
27
27
  "capabilities-markdown": "ts-node src/documentation/print-capabilities-markdown.ts",
28
28
  "wiki:df-graph": "ts-node src/documentation/print-dataflow-graph-wiki.ts",
29
29
  "wiki:normalized-ast": "ts-node src/documentation/print-normalized-ast-wiki.ts",
30
30
  "wiki:query-api": "ts-node src/documentation/print-query-wiki.ts",
31
+ "wiki:engines": "ts-node src/documentation/print-engines-wiki.ts",
31
32
  "wiki:search-api": "ts-node src/documentation/print-search-wiki.ts",
32
33
  "wiki:linting-and-testing": "ts-node src/documentation/print-linting-and-testing-wiki.ts",
33
34
  "wiki:interface": "ts-node src/documentation/print-interface-wiki.ts",
34
35
  "build": "tsc --project .",
35
- "build:bundle-flowr": "npm run build && esbuild --bundle dist/src/cli/flowr.js --platform=node --bundle --minify --target=node22 --outfile=dist/src/cli/flowr.min.js",
36
+ "build:bundle-flowr": "npm run build && esbuild --bundle dist/src/cli/flowr.js --platform=node --bundle --minify --target=node22 --outfile=dist/src/cli/flowr.min.js && npm run build:copy-wasm-min",
37
+ "build:copy-wasm": "cp src/r-bridge/lang-4.x/tree-sitter/tree-sitter-r.wasm dist/src/r-bridge/lang-4.x/tree-sitter/ && cp src/r-bridge/lang-4.x/tree-sitter/tree-sitter.wasm dist/src/r-bridge/lang-4.x/tree-sitter/",
38
+ "build:copy-wasm-min": "cp src/r-bridge/lang-4.x/tree-sitter/tree-sitter-r.wasm dist/src/cli && cp src/r-bridge/lang-4.x/tree-sitter/tree-sitter.wasm dist/src/cli",
36
39
  "lint-local": "npx eslint --version && npx eslint src/ test/ --rule \"no-warning-comments: off\"",
37
40
  "lint": "npm run license-compat -- --summary && npx eslint --version && npx eslint src/ test/",
38
41
  "license-compat": "license-checker --onlyAllow 'MIT;MIT OR X11;GPLv2;LGPL;GNUGPL;ISC;Apache-2.0;FreeBSD;BSD-2-Clause;clearbsd;ModifiedBSD;BSD-3-Clause;Python-2.0;Unlicense;WTFPL;BlueOak-1.0.0;CC-BY-4.0;CC-BY-3.0;CC0-1.0;0BSD'",
@@ -40,7 +43,7 @@
40
43
  "test": "vitest --exclude \"test/system-tests/**\" --config test/vitest.config.mts",
41
44
  "test:system": "vitest --dir test/system-tests --config test/system-tests/vitest.config.mts",
42
45
  "test:coverage": "npm run test -- --coverage",
43
- "performance-test": "func() { cd test/performance/ && bash run-all-suites.sh $1 $2 $3; cd ../../; }; func",
46
+ "performance-test": "func() { cd test/performance/ && bash run-all-suites.sh $1 $2 $3 $4; cd ../../; }; func",
44
47
  "test-full": "npm run test:coverage -- --no-watch -- --make-summary --test-installation",
45
48
  "detect-circular-deps": "npx madge --extensions ts,tsx --circular src/",
46
49
  "checkup": "npm run flowr -- --execute \":version\" && npm run lint && npm run test-full -- --allowOnly=false && npm run test:system -- --no-watch && docker build -t test-flowr -f scripts/Dockerfile . && npm run doc && npm-run-all wiki:*"
@@ -163,7 +166,7 @@
163
166
  "npm run lint",
164
167
  "npm run test-full"
165
168
  ],
166
- "after:bump": "npm run build",
169
+ "after:bump": "npm run build && npm run build:copy-wasm",
167
170
  "after:git:release": "echo After git push, before github release",
168
171
  "after:release": "echo Successfully released ${name} v${version} to ${repo.repository}."
169
172
  },
@@ -220,6 +223,7 @@
220
223
  "tmp": "^0.2.3",
221
224
  "ts-essentials": "^10.0.2",
222
225
  "tslog": "^4.9.3",
226
+ "web-tree-sitter": "^0.24.7",
223
227
  "ws": "^8.18.0",
224
228
  "xpath-ts2": "^1.4.2"
225
229
  }
@@ -18,7 +18,7 @@ export declare const ClusterQueryDefinition: {
18
18
  readonly name: "parse";
19
19
  readonly humanReadableName: "parse with R shell";
20
20
  readonly description: "Parse the given R code into an AST";
21
- readonly processor: (_results: unknown, input: Partial<import("../../../core/steps/all/core/00-parse").ParseRequiredInput>) => Promise<import("../../../core/steps/all/core/00-parse").ParseStepOutput>;
21
+ readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
22
22
  readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
23
23
  readonly printer: {
24
24
  readonly 0: typeof import("../../../core/print/print").internalPrinter;
@@ -26,16 +26,16 @@ export declare const ClusterQueryDefinition: {
26
26
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
27
27
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
28
28
  };
29
- readonly 5: ({ parsed }: import("../../../core/steps/all/core/00-parse").ParseStepOutput, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
29
+ readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
30
30
  };
31
31
  readonly dependencies: readonly [];
32
- readonly requiredInput: import("../../../core/steps/all/core/00-parse").ParseRequiredInput;
32
+ readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
33
33
  } | {
34
34
  readonly name: "normalize";
35
35
  readonly humanReadableName: "normalize";
36
36
  readonly description: "Normalize the AST to flowR's AST";
37
37
  readonly processor: (results: {
38
- parse?: import("../../../core/steps/all/core/00-parse").ParseStepOutput;
38
+ parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
39
39
  }, 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>>;
40
40
  readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
41
41
  readonly printer: {
@@ -53,6 +53,7 @@ export declare const ClusterQueryDefinition: {
53
53
  normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
54
54
  }, input: {
55
55
  request?: import("../../../r-bridge/retriever").RParseRequests;
56
+ parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
56
57
  }) => import("../../../dataflow/info").DataflowInformation;
57
58
  readonly requiredInput: {};
58
59
  readonly name: "dataflow";
@@ -18,7 +18,7 @@ export declare const DataflowQueryDefinition: {
18
18
  readonly name: "parse";
19
19
  readonly humanReadableName: "parse with R shell";
20
20
  readonly description: "Parse the given R code into an AST";
21
- readonly processor: (_results: unknown, input: Partial<import("../../../core/steps/all/core/00-parse").ParseRequiredInput>) => Promise<import("../../../core/steps/all/core/00-parse").ParseStepOutput>;
21
+ readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
22
22
  readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
23
23
  readonly printer: {
24
24
  readonly 0: typeof import("../../../core/print/print").internalPrinter;
@@ -26,16 +26,16 @@ export declare const DataflowQueryDefinition: {
26
26
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
27
27
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
28
28
  };
29
- readonly 5: ({ parsed }: import("../../../core/steps/all/core/00-parse").ParseStepOutput, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
29
+ readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
30
30
  };
31
31
  readonly dependencies: readonly [];
32
- readonly requiredInput: import("../../../core/steps/all/core/00-parse").ParseRequiredInput;
32
+ readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
33
33
  } | {
34
34
  readonly name: "normalize";
35
35
  readonly humanReadableName: "normalize";
36
36
  readonly description: "Normalize the AST to flowR's AST";
37
37
  readonly processor: (results: {
38
- parse?: import("../../../core/steps/all/core/00-parse").ParseStepOutput;
38
+ parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
39
39
  }, 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>>;
40
40
  readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
41
41
  readonly printer: {
@@ -53,6 +53,7 @@ export declare const DataflowQueryDefinition: {
53
53
  normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
54
54
  }, input: {
55
55
  request?: import("../../../r-bridge/retriever").RParseRequests;
56
+ parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
56
57
  }) => import("../../../dataflow/info").DataflowInformation;
57
58
  readonly requiredInput: {};
58
59
  readonly name: "dataflow";
@@ -49,7 +49,7 @@ export declare const DependenciesQueryDefinition: {
49
49
  readonly name: "parse";
50
50
  readonly humanReadableName: "parse with R shell";
51
51
  readonly description: "Parse the given R code into an AST";
52
- readonly processor: (_results: unknown, input: Partial<import("../../../core/steps/all/core/00-parse").ParseRequiredInput>) => Promise<import("../../../core/steps/all/core/00-parse").ParseStepOutput>;
52
+ readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
53
53
  readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
54
54
  readonly printer: {
55
55
  readonly 0: typeof import("../../../core/print/print").internalPrinter;
@@ -57,16 +57,16 @@ export declare const DependenciesQueryDefinition: {
57
57
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
58
58
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
59
59
  };
60
- readonly 5: ({ parsed }: import("../../../core/steps/all/core/00-parse").ParseStepOutput, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
60
+ readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
61
61
  };
62
62
  readonly dependencies: readonly [];
63
- readonly requiredInput: import("../../../core/steps/all/core/00-parse").ParseRequiredInput;
63
+ readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
64
64
  } | {
65
65
  readonly name: "normalize";
66
66
  readonly humanReadableName: "normalize";
67
67
  readonly description: "Normalize the AST to flowR's AST";
68
68
  readonly processor: (results: {
69
- parse?: import("../../../core/steps/all/core/00-parse").ParseStepOutput;
69
+ parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
70
70
  }, 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>>;
71
71
  readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
72
72
  readonly printer: {
@@ -84,6 +84,7 @@ export declare const DependenciesQueryDefinition: {
84
84
  normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
85
85
  }, input: {
86
86
  request?: import("../../../r-bridge/retriever").RParseRequests;
87
+ parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
87
88
  }) => import("../../../dataflow/info").DataflowInformation;
88
89
  readonly requiredInput: {};
89
90
  readonly name: "dataflow";
@@ -0,0 +1,3 @@
1
+ import type { BasicQueryData } from '../../base-query-format';
2
+ import type { HappensBeforeQuery, HappensBeforeQueryResult } from './happens-before-query-format';
3
+ export declare function executeHappensBefore({ ast }: BasicQueryData, queries: readonly HappensBeforeQuery[]): HappensBeforeQueryResult;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeHappensBefore = executeHappensBefore;
4
+ const logic_1 = require("../../../util/logic");
5
+ const log_1 = require("../../../util/log");
6
+ const cfg_1 = require("../../../util/cfg/cfg");
7
+ const happens_before_1 = require("../../../util/cfg/happens-before");
8
+ const parse_1 = require("../../../slicing/criterion/parse");
9
+ function executeHappensBefore({ ast }, queries) {
10
+ const start = Date.now();
11
+ const results = {};
12
+ const cfg = (0, cfg_1.extractCFG)(ast);
13
+ for (const query of queries) {
14
+ const { a, b } = query;
15
+ const fingerprint = `${a}<${b}`;
16
+ if (fingerprint in results) {
17
+ log_1.log.warn('Duplicate happens-before query', query, 'ignoring');
18
+ }
19
+ try {
20
+ const resolvedA = (0, parse_1.slicingCriterionToId)(a, ast.idMap);
21
+ const resolvedB = (0, parse_1.slicingCriterionToId)(b, ast.idMap);
22
+ results[fingerprint] = (0, happens_before_1.happensBefore)(cfg.graph, resolvedA, resolvedB);
23
+ }
24
+ catch (e) {
25
+ log_1.log.error('Error while executing happens-before query', query, e);
26
+ results[fingerprint] = logic_1.Ternary.Maybe;
27
+ }
28
+ }
29
+ return {
30
+ '.meta': {
31
+ timing: Date.now() - start
32
+ },
33
+ results
34
+ };
35
+ }
36
+ //# sourceMappingURL=happens-before-query-executor.js.map
@@ -0,0 +1,71 @@
1
+ import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
2
+ import Joi from 'joi';
3
+ import { executeHappensBefore } from './happens-before-query-executor';
4
+ import type { SingleSlicingCriterion } from '../../../slicing/criterion/parse';
5
+ import type { Ternary } from '../../../util/logic';
6
+ export interface HappensBeforeQuery extends BaseQueryFormat {
7
+ readonly type: 'happens-before';
8
+ readonly a: SingleSlicingCriterion;
9
+ readonly b: SingleSlicingCriterion;
10
+ }
11
+ export interface HappensBeforeQueryResult extends BaseQueryResult {
12
+ readonly results: Record<string, Ternary>;
13
+ }
14
+ export declare const HappensBeforeQueryDefinition: {
15
+ readonly executor: typeof executeHappensBefore;
16
+ readonly asciiSummarizer: (formatter: import("../../../util/ansi").OutputFormatter, _processed: import("../../../core/steps/pipeline/pipeline").PipelineOutput<import("../../../core/steps/pipeline/pipeline").Pipeline<{
17
+ readonly name: "parse";
18
+ readonly humanReadableName: "parse with R shell";
19
+ readonly description: "Parse the given R code into an AST";
20
+ readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
21
+ readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
22
+ readonly printer: {
23
+ readonly 0: typeof import("../../../core/print/print").internalPrinter;
24
+ readonly 2: {
25
+ (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
26
+ (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
27
+ };
28
+ readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
29
+ };
30
+ readonly dependencies: readonly [];
31
+ readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
32
+ } | {
33
+ readonly name: "normalize";
34
+ readonly humanReadableName: "normalize";
35
+ readonly description: "Normalize the AST to flowR's AST";
36
+ readonly processor: (results: {
37
+ parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
38
+ }, 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>>;
39
+ readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
40
+ readonly printer: {
41
+ readonly 0: typeof import("../../../core/print/print").internalPrinter;
42
+ readonly 2: typeof import("../../../core/print/normalize-printer").normalizedAstToJson;
43
+ readonly 5: typeof import("../../../core/print/normalize-printer").normalizedAstToQuads;
44
+ readonly 3: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaid;
45
+ readonly 4: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaidUrl;
46
+ };
47
+ readonly dependencies: readonly ["parse"];
48
+ readonly requiredInput: import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput;
49
+ } | {
50
+ readonly humanReadableName: "dataflow";
51
+ readonly processor: (results: {
52
+ normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
53
+ }, input: {
54
+ request?: import("../../../r-bridge/retriever").RParseRequests;
55
+ parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
56
+ }) => import("../../../dataflow/info").DataflowInformation;
57
+ readonly requiredInput: {};
58
+ readonly name: "dataflow";
59
+ readonly description: "Construct the dataflow graph";
60
+ readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
61
+ readonly printer: {
62
+ readonly 0: typeof import("../../../core/print/print").internalPrinter;
63
+ readonly 2: typeof import("../../../core/print/dataflow-printer").dataflowGraphToJson;
64
+ readonly 5: typeof import("../../../core/print/dataflow-printer").dataflowGraphToQuads;
65
+ readonly 3: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaid;
66
+ readonly 4: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaidUrl;
67
+ };
68
+ readonly dependencies: readonly ["normalize"];
69
+ }>>, queryResults: BaseQueryResult, result: string[]) => true;
70
+ readonly schema: Joi.ObjectSchema<any>;
71
+ };
@@ -0,0 +1,27 @@
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.HappensBeforeQueryDefinition = void 0;
7
+ const ansi_1 = require("../../../util/ansi");
8
+ const time_1 = require("../../../util/time");
9
+ const joi_1 = __importDefault(require("joi"));
10
+ const happens_before_query_executor_1 = require("./happens-before-query-executor");
11
+ exports.HappensBeforeQueryDefinition = {
12
+ executor: happens_before_query_executor_1.executeHappensBefore,
13
+ asciiSummarizer: (formatter, _processed, queryResults, result) => {
14
+ const out = queryResults;
15
+ result.push(`Query: ${(0, ansi_1.bold)('happens-before', formatter)} (${(0, time_1.printAsMs)(out['.meta'].timing, 0)})`);
16
+ for (const [key, value] of Object.entries(out.results)) {
17
+ result.push(` ╰ ${key}: ${value}`);
18
+ }
19
+ return true;
20
+ },
21
+ schema: joi_1.default.object({
22
+ type: joi_1.default.string().valid('happens-before').required().description('The type of the query.'),
23
+ a: joi_1.default.string().required().description('The first slicing criterion.'),
24
+ b: joi_1.default.string().required().description('The second slicing criterion.')
25
+ }).description('The id map query retrieves the id map from the normalized AST.')
26
+ };
27
+ //# sourceMappingURL=happens-before-query-format.js.map
@@ -14,7 +14,7 @@ export declare const IdMapQueryDefinition: {
14
14
  readonly name: "parse";
15
15
  readonly humanReadableName: "parse with R shell";
16
16
  readonly description: "Parse the given R code into an AST";
17
- readonly processor: (_results: unknown, input: Partial<import("../../../core/steps/all/core/00-parse").ParseRequiredInput>) => Promise<import("../../../core/steps/all/core/00-parse").ParseStepOutput>;
17
+ readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
18
18
  readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
19
19
  readonly printer: {
20
20
  readonly 0: typeof import("../../../core/print/print").internalPrinter;
@@ -22,16 +22,16 @@ export declare const IdMapQueryDefinition: {
22
22
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
23
23
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
24
24
  };
25
- readonly 5: ({ parsed }: import("../../../core/steps/all/core/00-parse").ParseStepOutput, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
25
+ readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
26
26
  };
27
27
  readonly dependencies: readonly [];
28
- readonly requiredInput: import("../../../core/steps/all/core/00-parse").ParseRequiredInput;
28
+ readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
29
29
  } | {
30
30
  readonly name: "normalize";
31
31
  readonly humanReadableName: "normalize";
32
32
  readonly description: "Normalize the AST to flowR's AST";
33
33
  readonly processor: (results: {
34
- parse?: import("../../../core/steps/all/core/00-parse").ParseStepOutput;
34
+ parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
35
35
  }, 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>>;
36
36
  readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
37
37
  readonly printer: {
@@ -49,6 +49,7 @@ export declare const IdMapQueryDefinition: {
49
49
  normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
50
50
  }, input: {
51
51
  request?: import("../../../r-bridge/retriever").RParseRequests;
52
+ parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
52
53
  }) => import("../../../dataflow/info").DataflowInformation;
53
54
  readonly requiredInput: {};
54
55
  readonly name: "dataflow";
@@ -20,7 +20,7 @@ export declare const LineageQueryDefinition: {
20
20
  readonly name: "parse";
21
21
  readonly humanReadableName: "parse with R shell";
22
22
  readonly description: "Parse the given R code into an AST";
23
- readonly processor: (_results: unknown, input: Partial<import("../../../core/steps/all/core/00-parse").ParseRequiredInput>) => Promise<import("../../../core/steps/all/core/00-parse").ParseStepOutput>;
23
+ readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
24
24
  readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
25
25
  readonly printer: {
26
26
  readonly 0: typeof import("../../../core/print/print").internalPrinter;
@@ -28,16 +28,16 @@ export declare const LineageQueryDefinition: {
28
28
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
29
29
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
30
30
  };
31
- readonly 5: ({ parsed }: import("../../../core/steps/all/core/00-parse").ParseStepOutput, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
31
+ readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
32
32
  };
33
33
  readonly dependencies: readonly [];
34
- readonly requiredInput: import("../../../core/steps/all/core/00-parse").ParseRequiredInput;
34
+ readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
35
35
  } | {
36
36
  readonly name: "normalize";
37
37
  readonly humanReadableName: "normalize";
38
38
  readonly description: "Normalize the AST to flowR's AST";
39
39
  readonly processor: (results: {
40
- parse?: import("../../../core/steps/all/core/00-parse").ParseStepOutput;
40
+ parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
41
41
  }, 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>>;
42
42
  readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
43
43
  readonly printer: {
@@ -55,6 +55,7 @@ export declare const LineageQueryDefinition: {
55
55
  normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
56
56
  }, input: {
57
57
  request?: import("../../../r-bridge/retriever").RParseRequests;
58
+ parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
58
59
  }) => import("../../../dataflow/info").DataflowInformation;
59
60
  readonly requiredInput: {};
60
61
  readonly name: "dataflow";
@@ -17,7 +17,7 @@ export declare const NormalizedAstQueryDefinition: {
17
17
  readonly name: "parse";
18
18
  readonly humanReadableName: "parse with R shell";
19
19
  readonly description: "Parse the given R code into an AST";
20
- readonly processor: (_results: unknown, input: Partial<import("../../../core/steps/all/core/00-parse").ParseRequiredInput>) => Promise<import("../../../core/steps/all/core/00-parse").ParseStepOutput>;
20
+ readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
21
21
  readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
22
22
  readonly printer: {
23
23
  readonly 0: typeof import("../../../core/print/print").internalPrinter;
@@ -25,16 +25,16 @@ export declare const NormalizedAstQueryDefinition: {
25
25
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
26
26
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
27
27
  };
28
- readonly 5: ({ parsed }: import("../../../core/steps/all/core/00-parse").ParseStepOutput, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
28
+ readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
29
29
  };
30
30
  readonly dependencies: readonly [];
31
- readonly requiredInput: import("../../../core/steps/all/core/00-parse").ParseRequiredInput;
31
+ readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
32
32
  } | {
33
33
  readonly name: "normalize";
34
34
  readonly humanReadableName: "normalize";
35
35
  readonly description: "Normalize the AST to flowR's AST";
36
36
  readonly processor: (results: {
37
- parse?: import("../../../core/steps/all/core/00-parse").ParseStepOutput;
37
+ parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
38
38
  }, input: Partial<import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => 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>>;
39
39
  readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
40
40
  readonly printer: {
@@ -52,6 +52,7 @@ export declare const NormalizedAstQueryDefinition: {
52
52
  normalize?: NormalizedAst;
53
53
  }, input: {
54
54
  request?: import("../../../r-bridge/retriever").RParseRequests;
55
+ parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
55
56
  }) => import("../../../dataflow/info").DataflowInformation;
56
57
  readonly requiredInput: {};
57
58
  readonly name: "dataflow";
@@ -1,13 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeSearch = executeSearch;
4
- const log_1 = require("../../../util/log");
5
4
  const flowr_search_executor_1 = require("../../../search/flowr-search-executor");
6
5
  function executeSearch({ ast, dataflow }, queries) {
7
6
  const start = Date.now();
8
- if (queries.length !== 1) {
9
- log_1.log.warn('Id-Map query expects only up to one query, but got', queries.length);
10
- }
11
7
  const results = [];
12
8
  for (const query of queries) {
13
9
  const { search } = query;
@@ -19,7 +19,7 @@ export declare const SearchQueryDefinition: {
19
19
  readonly name: "parse";
20
20
  readonly humanReadableName: "parse with R shell";
21
21
  readonly description: "Parse the given R code into an AST";
22
- readonly processor: (_results: unknown, input: Partial<import("../../../core/steps/all/core/00-parse").ParseRequiredInput>) => Promise<import("../../../core/steps/all/core/00-parse").ParseStepOutput>;
22
+ readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
23
23
  readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
24
24
  readonly printer: {
25
25
  readonly 0: typeof import("../../../core/print/print").internalPrinter;
@@ -27,16 +27,16 @@ export declare const SearchQueryDefinition: {
27
27
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
28
28
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
29
29
  };
30
- readonly 5: ({ parsed }: import("../../../core/steps/all/core/00-parse").ParseStepOutput, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
30
+ readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
31
31
  };
32
32
  readonly dependencies: readonly [];
33
- readonly requiredInput: import("../../../core/steps/all/core/00-parse").ParseRequiredInput;
33
+ readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
34
34
  } | {
35
35
  readonly name: "normalize";
36
36
  readonly humanReadableName: "normalize";
37
37
  readonly description: "Normalize the AST to flowR's AST";
38
38
  readonly processor: (results: {
39
- parse?: import("../../../core/steps/all/core/00-parse").ParseStepOutput;
39
+ parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
40
40
  }, 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>>;
41
41
  readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
42
42
  readonly printer: {
@@ -54,6 +54,7 @@ export declare const SearchQueryDefinition: {
54
54
  normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
55
55
  }, input: {
56
56
  request?: import("../../../r-bridge/retriever").RParseRequests;
57
+ parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
57
58
  }) => import("../../../dataflow/info").DataflowInformation;
58
59
  readonly requiredInput: {};
59
60
  readonly name: "dataflow";
@@ -30,7 +30,7 @@ export declare const StaticSliceQueryDefinition: {
30
30
  readonly name: "parse";
31
31
  readonly humanReadableName: "parse with R shell";
32
32
  readonly description: "Parse the given R code into an AST";
33
- readonly processor: (_results: unknown, input: Partial<import("../../../core/steps/all/core/00-parse").ParseRequiredInput>) => Promise<import("../../../core/steps/all/core/00-parse").ParseStepOutput>;
33
+ readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
34
34
  readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
35
35
  readonly printer: {
36
36
  readonly 0: typeof import("../../../core/print/print").internalPrinter;
@@ -38,16 +38,16 @@ export declare const StaticSliceQueryDefinition: {
38
38
  (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
39
39
  (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
40
40
  };
41
- readonly 5: ({ parsed }: import("../../../core/steps/all/core/00-parse").ParseStepOutput, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
41
+ readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
42
42
  };
43
43
  readonly dependencies: readonly [];
44
- readonly requiredInput: import("../../../core/steps/all/core/00-parse").ParseRequiredInput;
44
+ readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
45
45
  } | {
46
46
  readonly name: "normalize";
47
47
  readonly humanReadableName: "normalize";
48
48
  readonly description: "Normalize the AST to flowR's AST";
49
49
  readonly processor: (results: {
50
- parse?: import("../../../core/steps/all/core/00-parse").ParseStepOutput;
50
+ parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
51
51
  }, 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>>;
52
52
  readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
53
53
  readonly printer: {
@@ -65,6 +65,7 @@ export declare const StaticSliceQueryDefinition: {
65
65
  normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
66
66
  }, input: {
67
67
  request?: import("../../../r-bridge/retriever").RParseRequests;
68
+ parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
68
69
  }) => import("../../../dataflow/info").DataflowInformation;
69
70
  readonly requiredInput: {};
70
71
  readonly name: "dataflow";