@eagleoutice/flowr 2.10.8 → 2.10.10
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.
- package/README.md +106 -36
- package/abstract-interpretation/absint-visitor.js +6 -3
- package/abstract-interpretation/domains/abstract-domain.d.ts +1 -1
- package/abstract-interpretation/domains/bounded-set-domain.d.ts +1 -1
- package/abstract-interpretation/domains/bounded-set-domain.js +1 -1
- package/abstract-interpretation/domains/interval-domain.d.ts +1 -1
- package/abstract-interpretation/domains/interval-domain.js +1 -1
- package/abstract-interpretation/domains/lattice.d.ts +1 -1
- package/abstract-interpretation/domains/partial-product-domain.d.ts +1 -1
- package/abstract-interpretation/domains/partial-product-domain.js +2 -2
- package/abstract-interpretation/domains/set-range-domain.d.ts +1 -1
- package/abstract-interpretation/domains/set-range-domain.js +1 -1
- package/abstract-interpretation/domains/set-upper-bound-domain.d.ts +1 -1
- package/abstract-interpretation/domains/set-upper-bound-domain.js +1 -1
- package/abstract-interpretation/domains/singleton-domain.d.ts +1 -1
- package/abstract-interpretation/domains/singleton-domain.js +1 -1
- package/abstract-interpretation/domains/state-abstract-domain.d.ts +1 -1
- package/abstract-interpretation/domains/state-abstract-domain.js +2 -2
- package/abstract-interpretation/unsupported-functions.d.ts +3 -2
- package/abstract-interpretation/unsupported-functions.js +38 -28
- package/cli/benchmark-app.js +2 -1
- package/cli/common/script.js +3 -2
- package/cli/flowr.js +47 -10
- package/cli/repl/commands/repl-cfg.js +9 -9
- package/cli/repl/commands/repl-commands.js +5 -0
- package/cli/repl/commands/repl-dataflow.js +31 -24
- package/cli/repl/commands/repl-main.d.ts +6 -0
- package/cli/repl/commands/repl-normalize.js +15 -12
- package/cli/repl/commands/repl-parse.js +1 -1
- package/cli/repl/commands/repl-query.js +4 -5
- package/cli/repl/commands/repl-quit.js +2 -1
- package/cli/repl/core.d.ts +11 -0
- package/cli/repl/core.js +101 -3
- package/cli/repl/execute.js +3 -2
- package/cli/repl/parser/slice-query-parser.d.ts +16 -0
- package/cli/repl/parser/slice-query-parser.js +52 -0
- package/cli/repl/server/connection.d.ts +1 -0
- package/cli/repl/server/connection.js +25 -0
- package/cli/repl/server/messages/message-analysis.d.ts +10 -0
- package/cli/repl/server/messages/message-analysis.js +6 -2
- package/cli/repl/server/messages/message-slice.d.ts +1 -1
- package/cli/script-core/statistics-core.js +2 -1
- package/cli/script-core/statistics-helper-core.js +2 -1
- package/cli/wiki.d.ts +2 -1
- package/cli/wiki.js +4 -1
- package/config.d.ts +9 -0
- package/config.js +23 -1
- package/control-flow/diff-cfg.d.ts +1 -1
- package/control-flow/diff-cfg.js +1 -1
- package/control-flow/extract-cfg.js +9 -3
- package/control-flow/semantic-cfg-guided-visitor.js +1 -0
- package/control-flow/simple-visitor.js +6 -5
- package/control-flow/useless-loop.js +2 -2
- package/core/print/dataflow-printer.d.ts +2 -2
- package/core/print/dataflow-printer.js +2 -2
- package/core/steps/all/static-slicing/00-slice.js +1 -1
- package/core/steps/pipeline/default-pipelines.d.ts +146 -146
- package/dataflow/environments/append.d.ts +2 -1
- package/dataflow/environments/append.js +2 -1
- package/dataflow/environments/built-in-proc-name.d.ts +2 -0
- package/dataflow/environments/built-in-proc-name.js +2 -0
- package/dataflow/environments/built-in.d.ts +2 -0
- package/dataflow/environments/built-in.js +2 -0
- package/dataflow/environments/default-builtin-config.d.ts +122 -66
- package/dataflow/environments/default-builtin-config.js +324 -145
- package/dataflow/environments/environment.d.ts +2 -1
- package/dataflow/environments/environment.js +13 -9
- package/dataflow/environments/identifier.d.ts +55 -2
- package/dataflow/environments/identifier.js +14 -2
- package/dataflow/environments/reference-to-maybe.d.ts +2 -0
- package/dataflow/environments/reference-to-maybe.js +56 -11
- package/dataflow/environments/resolve-by-name.js +13 -7
- package/dataflow/eval/values/general.js +4 -0
- package/dataflow/extractor.js +22 -3
- package/dataflow/graph/df-helper.d.ts +6 -0
- package/dataflow/graph/df-helper.js +33 -0
- package/dataflow/graph/graph.js +7 -3
- package/dataflow/info.d.ts +1 -1
- package/dataflow/info.js +3 -1
- package/dataflow/internal/linker.d.ts +5 -1
- package/dataflow/internal/linker.js +34 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +53 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.d.ts +13 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-namespace-access.js +58 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +38 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +1 -1
- package/dataflow/internal/process/functions/call/known-call-handling.js +4 -3
- package/dataflow/internal/process/functions/call/named-call-handling.js +6 -0
- package/dataflow/origin/dfg-get-origin.d.ts +1 -1
- package/dataflow/origin/dfg-get-origin.js +1 -1
- package/dataflow/processor.d.ts +6 -0
- package/documentation/data/faq/faqs.d.ts +2 -1
- package/documentation/data/faq/faqs.js +75 -57
- package/documentation/data/server/doc-data-server-messages.d.ts +2 -1
- package/documentation/data/server/doc-data-server-messages.js +15 -7
- package/documentation/doc-readme.js +15 -15
- package/documentation/doc-util/doc-cfg.d.ts +3 -1
- package/documentation/doc-util/doc-cfg.js +3 -3
- package/documentation/doc-util/doc-dfg.d.ts +3 -1
- package/documentation/doc-util/doc-dfg.js +3 -3
- package/documentation/doc-util/doc-files.d.ts +3 -1
- package/documentation/doc-util/doc-files.js +9 -6
- package/documentation/doc-util/doc-normalized-ast.d.ts +3 -1
- package/documentation/doc-util/doc-normalized-ast.js +2 -2
- package/documentation/doc-util/doc-query.d.ts +2 -1
- package/documentation/doc-util/doc-query.js +2 -2
- package/documentation/doc-util/doc-repl.js +1 -0
- package/documentation/doc-util/doc-types.d.ts +6 -6
- package/documentation/doc-util/doc-types.js +11 -9
- package/documentation/issue-linting-rule.js +1 -2
- package/documentation/wiki-analyzer.js +9 -9
- package/documentation/wiki-cfg.js +40 -41
- package/documentation/wiki-core.js +119 -31
- package/documentation/wiki-create-linting-rules.d.ts +6 -0
- package/documentation/wiki-create-linting-rules.js +95 -0
- package/documentation/wiki-dataflow-graph.js +77 -76
- package/documentation/wiki-engine.js +1 -2
- package/documentation/wiki-faq.d.ts +2 -1
- package/documentation/wiki-faq.js +4 -4
- package/documentation/wiki-interface.js +19 -6
- package/documentation/wiki-linter.d.ts +1 -1
- package/documentation/wiki-linter.js +14 -6
- package/documentation/wiki-linting-and-testing.js +2 -2
- package/documentation/wiki-mk/doc-context.d.ts +3 -3
- package/documentation/wiki-mk/doc-maker.d.ts +2 -0
- package/documentation/wiki-mk/doc-maker.js +7 -1
- package/documentation/wiki-normalized-ast.js +5 -5
- package/documentation/wiki-onboarding.d.ts +2 -1
- package/documentation/wiki-onboarding.js +5 -5
- package/documentation/wiki-overview.js +3 -3
- package/documentation/wiki-query.js +85 -84
- package/documentation/wiki-search.js +4 -5
- package/documentation/wiki-setup.js +6 -7
- package/gas.d.ts +74 -0
- package/gas.js +18 -0
- package/linter/linter-executor.js +2 -8
- package/linter/linter-format.d.ts +4 -11
- package/linter/linter-rules.d.ts +88 -86
- package/linter/linter-rules.js +7 -1
- package/linter/rules/absolute-path.d.ts +2 -7
- package/linter/rules/absolute-path.js +6 -4
- package/linter/rules/dataframe-access-validation.d.ts +1 -6
- package/linter/rules/dataframe-access-validation.js +8 -6
- package/linter/rules/dead-code.d.ts +2 -11
- package/linter/rules/dead-code.js +16 -11
- package/linter/rules/deprecated-functions.d.ts +3 -3
- package/linter/rules/file-path-validity.d.ts +1 -6
- package/linter/rules/file-path-validity.js +5 -5
- package/linter/rules/function-finder-util.d.ts +7 -11
- package/linter/rules/function-finder-util.js +9 -6
- package/linter/rules/naming-convention.d.ts +2 -7
- package/linter/rules/naming-convention.js +3 -2
- package/linter/rules/network-functions.d.ts +2 -7
- package/linter/rules/network-functions.js +14 -12
- package/linter/rules/no-leaked-credentials.d.ts +36 -0
- package/linter/rules/no-leaked-credentials.js +75 -0
- package/linter/rules/problematic-inputs.d.ts +1 -8
- package/linter/rules/problematic-inputs.js +5 -4
- package/linter/rules/roxygen-arguments.d.ts +2 -7
- package/linter/rules/roxygen-arguments.js +13 -20
- package/linter/rules/seeded-randomness.d.ts +2 -7
- package/linter/rules/seeded-randomness.js +7 -4
- package/linter/rules/software-has-license.d.ts +31 -0
- package/linter/rules/software-has-license.js +46 -0
- package/linter/rules/software-has-tests.d.ts +38 -0
- package/linter/rules/software-has-tests.js +48 -0
- package/linter/rules/stop-with-call-arg.d.ts +2 -7
- package/linter/rules/stop-with-call-arg.js +3 -2
- package/linter/rules/unused-definition.d.ts +3 -8
- package/linter/rules/unused-definition.js +7 -5
- package/linter/rules/useless-loop.d.ts +2 -7
- package/linter/rules/useless-loop.js +5 -2
- package/package.json +3 -2
- package/project/context/flowr-analyzer-context.d.ts +13 -14
- package/project/context/flowr-analyzer-context.js +4 -0
- package/project/context/flowr-analyzer-files-context.d.ts +12 -0
- package/project/context/flowr-analyzer-files-context.js +12 -2
- package/project/context/flowr-analyzer-gas-context.d.ts +28 -0
- package/project/context/flowr-analyzer-gas-context.js +101 -0
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +13 -7
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +56 -11
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +1 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +2 -2
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -1
- package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +5 -5
- package/project/plugins/flowr-analyzer-plugin.d.ts +15 -8
- package/project/plugins/flowr-analyzer-plugin.js +14 -7
- package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.d.ts +19 -0
- package/project/plugins/gas-plugins/flowr-analyzer-gas-plugin.js +35 -0
- package/project/plugins/plugin-registry.d.ts +2 -1
- package/project/plugins/plugin-registry.js +3 -1
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.d.ts +22 -0
- package/project/plugins/project-discovery/flowr-analyzer-gitignore-project-discovery-plugin.js +47 -0
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +54 -8
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +2 -2
- package/queries/catalog/dependencies-query/function-info/test-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/test-functions.js +18 -177
- package/queries/catalog/df-shape-query/df-shape-query-format.js +1 -1
- package/queries/catalog/dice-query/dice-query-executor.d.ts +8 -0
- package/queries/catalog/dice-query/dice-query-executor.js +52 -0
- package/queries/catalog/dice-query/dice-query-format.d.ts +53 -0
- package/queries/catalog/dice-query/dice-query-format.js +102 -0
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +2 -2
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +2 -0
- package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +2 -0
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +1 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +2 -0
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -0
- package/queries/catalog/linter-query/linter-query-executor.js +7 -0
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +2 -0
- package/queries/catalog/location-map-query/location-map-query-format.js +1 -0
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -0
- package/queries/catalog/origin-query/origin-query-format.js +1 -0
- package/queries/catalog/provenance-query/provenance-query-format.d.ts +2 -0
- package/queries/catalog/provenance-query/provenance-query-format.js +1 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +2 -0
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +1 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +2 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.js +1 -0
- package/queries/query.d.ts +18 -1
- package/queries/query.js +3 -1
- package/r-bridge/data/data.d.ts +5 -0
- package/r-bridge/data/data.js +6 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +0 -1
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +10 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +63 -44
- package/r-bridge/parser.js +2 -9
- package/r-bridge/shell.d.ts +8 -1
- package/r-bridge/shell.js +26 -7
- package/search/flowr-search-builder.d.ts +2 -2
- package/search/flowr-search-builder.js +1 -1
- package/search/flowr-search-filters.d.ts +30 -9
- package/search/flowr-search-filters.js +26 -21
- package/search/search-executor/search-enrichers.d.ts +600 -0
- package/search/search-executor/search-enrichers.js +23 -2
- package/slicing/static/static-slicer.d.ts +39 -11
- package/slicing/static/static-slicer.js +44 -14
- package/util/collections/queue.d.ts +16 -0
- package/util/collections/queue.js +38 -0
- package/util/log.d.ts +1 -1
- package/util/log.js +1 -1
- package/util/mermaid/dfg.d.ts +2 -2
- package/util/mermaid/dfg.js +2 -2
- package/util/objects.d.ts +9 -0
- package/util/objects.js +57 -1
- package/util/proc.d.ts +6 -0
- package/util/proc.js +20 -0
- package/util/version.js +1 -1
|
@@ -85,13 +85,24 @@ function convertTreeNode(node) {
|
|
|
85
85
|
// generally, the grammar source file dictates what children a node has in what order:
|
|
86
86
|
// https://github.com/r-lib/tree-sitter-r/blob/main/grammar.js
|
|
87
87
|
const range = makeSourceRange(node);
|
|
88
|
-
|
|
88
|
+
/* node.text re-assembles the subtree text on every access, so read it lazily and at most once */
|
|
89
|
+
let textCache = undefined;
|
|
90
|
+
const text = () => {
|
|
91
|
+
textCache ??= node.text;
|
|
92
|
+
return textCache;
|
|
93
|
+
};
|
|
94
|
+
const makeDefaultInfo = () => ({
|
|
89
95
|
info: {
|
|
90
96
|
fullRange: range,
|
|
91
97
|
adToks: [],
|
|
92
|
-
fullLexeme:
|
|
98
|
+
fullLexeme: text(),
|
|
93
99
|
tsId: node.id
|
|
94
100
|
}
|
|
101
|
+
});
|
|
102
|
+
let defaultInfoCache = undefined;
|
|
103
|
+
const defaultInfo = () => {
|
|
104
|
+
defaultInfoCache ??= makeDefaultInfo();
|
|
105
|
+
return defaultInfoCache;
|
|
95
106
|
};
|
|
96
107
|
switch (node.type) {
|
|
97
108
|
case tree_sitter_types_1.TreeSitterType.Program: {
|
|
@@ -127,13 +138,13 @@ function convertTreeNode(node) {
|
|
|
127
138
|
location: makeSourceRange(opening),
|
|
128
139
|
content: (0, retriever_1.removeRQuotes)(opening.text),
|
|
129
140
|
lexeme: opening.text,
|
|
130
|
-
...defaultInfo
|
|
141
|
+
...defaultInfo()
|
|
131
142
|
}, {
|
|
132
143
|
type: type_1.RType.Symbol,
|
|
133
144
|
location: makeSourceRange(closing),
|
|
134
145
|
content: (0, retriever_1.removeRQuotes)(closing.text),
|
|
135
146
|
lexeme: closing.text,
|
|
136
|
-
...defaultInfo
|
|
147
|
+
...defaultInfo()
|
|
137
148
|
}
|
|
138
149
|
],
|
|
139
150
|
info: {
|
|
@@ -163,7 +174,7 @@ function convertTreeNode(node) {
|
|
|
163
174
|
return {
|
|
164
175
|
type: type_1.RType.FunctionCall,
|
|
165
176
|
location: opSource,
|
|
166
|
-
lexeme:
|
|
177
|
+
lexeme: text(),
|
|
167
178
|
functionName: {
|
|
168
179
|
type: type_1.RType.Symbol,
|
|
169
180
|
location: opSource,
|
|
@@ -198,11 +209,11 @@ function convertTreeNode(node) {
|
|
|
198
209
|
lhs: lhsAsArg,
|
|
199
210
|
rhs,
|
|
200
211
|
lexeme: op.text,
|
|
201
|
-
...defaultInfo,
|
|
212
|
+
...defaultInfo(),
|
|
202
213
|
info: {
|
|
203
214
|
fullRange: range,
|
|
204
215
|
adToks: comments,
|
|
205
|
-
fullLexeme:
|
|
216
|
+
fullLexeme: text(),
|
|
206
217
|
tsId: node.id
|
|
207
218
|
}
|
|
208
219
|
};
|
|
@@ -217,7 +228,7 @@ function convertTreeNode(node) {
|
|
|
217
228
|
info: {
|
|
218
229
|
fullRange: range,
|
|
219
230
|
adToks: comments,
|
|
220
|
-
fullLexeme:
|
|
231
|
+
fullLexeme: text(),
|
|
221
232
|
tsId: node.id
|
|
222
233
|
}
|
|
223
234
|
};
|
|
@@ -233,19 +244,27 @@ function convertTreeNode(node) {
|
|
|
233
244
|
operator: op.text,
|
|
234
245
|
lexeme: op.text,
|
|
235
246
|
info: {
|
|
236
|
-
...defaultInfo.info,
|
|
247
|
+
...defaultInfo().info,
|
|
237
248
|
adToks: comments.map(c => c[1]),
|
|
238
249
|
}
|
|
239
250
|
};
|
|
240
251
|
}
|
|
241
252
|
case tree_sitter_types_1.TreeSitterType.NamespaceOperator: {
|
|
242
|
-
const [
|
|
253
|
+
const [comments, children] = splitComments(nonErrorChildren(node));
|
|
254
|
+
if (children.length < 3) {
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
const [lhs, int, rhs] = children;
|
|
243
258
|
return {
|
|
244
259
|
type: type_1.RType.Symbol,
|
|
245
260
|
location: makeSourceRange(rhs),
|
|
246
261
|
content: identifier_1.Identifier.make(rhs.text, lhs.text, int.text === ':::'),
|
|
247
262
|
lexeme: rhs.text,
|
|
248
|
-
...defaultInfo
|
|
263
|
+
...defaultInfo(),
|
|
264
|
+
info: {
|
|
265
|
+
...defaultInfo().info,
|
|
266
|
+
adToks: comments.map(c => c[1]),
|
|
267
|
+
}
|
|
249
268
|
};
|
|
250
269
|
}
|
|
251
270
|
case '(':
|
|
@@ -259,9 +278,9 @@ function convertTreeNode(node) {
|
|
|
259
278
|
return {
|
|
260
279
|
type: type_1.RType.Symbol,
|
|
261
280
|
location: range,
|
|
262
|
-
content: (0, strings_1.startAndEndsWith)(
|
|
263
|
-
lexeme:
|
|
264
|
-
...defaultInfo
|
|
281
|
+
content: (0, strings_1.startAndEndsWith)(text(), '`') ? text().slice(1, -1) : (0, retriever_1.removeRQuotes)(text()),
|
|
282
|
+
lexeme: text(),
|
|
283
|
+
...defaultInfo()
|
|
265
284
|
};
|
|
266
285
|
case tree_sitter_types_1.TreeSitterType.IfStatement: {
|
|
267
286
|
const [comments, children] = splitComments(nonErrorChildren(node));
|
|
@@ -275,7 +294,7 @@ function convertTreeNode(node) {
|
|
|
275
294
|
location: makeSourceRange(ifNode),
|
|
276
295
|
lexeme: ifNode.text,
|
|
277
296
|
info: {
|
|
278
|
-
...defaultInfo.info,
|
|
297
|
+
...defaultInfo().info,
|
|
279
298
|
adToks: comments.map(c => c[1]),
|
|
280
299
|
}
|
|
281
300
|
};
|
|
@@ -309,7 +328,7 @@ function convertTreeNode(node) {
|
|
|
309
328
|
info: {
|
|
310
329
|
fullRange: range,
|
|
311
330
|
adToks: variableComments.concat(comments, sequenceComments).map(c => c[1]),
|
|
312
|
-
fullLexeme:
|
|
331
|
+
fullLexeme: text(),
|
|
313
332
|
tsId: node.id
|
|
314
333
|
}
|
|
315
334
|
};
|
|
@@ -324,7 +343,7 @@ function convertTreeNode(node) {
|
|
|
324
343
|
location: makeSourceRange(whileNode),
|
|
325
344
|
lexeme: whileNode.text,
|
|
326
345
|
info: {
|
|
327
|
-
...defaultInfo.info,
|
|
346
|
+
...defaultInfo().info,
|
|
328
347
|
adToks: comments.map(c => c[1]),
|
|
329
348
|
}
|
|
330
349
|
};
|
|
@@ -337,7 +356,7 @@ function convertTreeNode(node) {
|
|
|
337
356
|
location: makeSourceRange(repeatNode),
|
|
338
357
|
lexeme: repeatNode.text,
|
|
339
358
|
info: {
|
|
340
|
-
...defaultInfo.info,
|
|
359
|
+
...defaultInfo().info,
|
|
341
360
|
adToks: comments.map(c => c[1]),
|
|
342
361
|
}
|
|
343
362
|
};
|
|
@@ -348,7 +367,7 @@ function convertTreeNode(node) {
|
|
|
348
367
|
if (func.type === tree_sitter_types_1.TreeSitterType.Next || func.type === tree_sitter_types_1.TreeSitterType.Break) {
|
|
349
368
|
return {
|
|
350
369
|
...convertTreeNode(func),
|
|
351
|
-
...defaultInfo
|
|
370
|
+
...defaultInfo()
|
|
352
371
|
};
|
|
353
372
|
}
|
|
354
373
|
const rawArgs = nonErrorChildren(argsParentheses);
|
|
@@ -360,9 +379,9 @@ function convertTreeNode(node) {
|
|
|
360
379
|
arguments: mappedArgs,
|
|
361
380
|
location: funcRange,
|
|
362
381
|
lexeme: func.text,
|
|
363
|
-
...defaultInfo,
|
|
382
|
+
...defaultInfo(),
|
|
364
383
|
info: {
|
|
365
|
-
...defaultInfo.info,
|
|
384
|
+
...defaultInfo().info,
|
|
366
385
|
adToks: comments.map(c => c[1]),
|
|
367
386
|
}
|
|
368
387
|
};
|
|
@@ -383,7 +402,7 @@ function convertTreeNode(node) {
|
|
|
383
402
|
info: {
|
|
384
403
|
fullRange: range,
|
|
385
404
|
adToks: [],
|
|
386
|
-
fullLexeme:
|
|
405
|
+
fullLexeme: text(),
|
|
387
406
|
tsId: node.id
|
|
388
407
|
}
|
|
389
408
|
},
|
|
@@ -410,7 +429,7 @@ function convertTreeNode(node) {
|
|
|
410
429
|
location: makeSourceRange(name),
|
|
411
430
|
lexeme: name.text,
|
|
412
431
|
info: {
|
|
413
|
-
...defaultInfo.info,
|
|
432
|
+
...defaultInfo().info,
|
|
414
433
|
adToks: comments.map(c => c[1]),
|
|
415
434
|
}
|
|
416
435
|
};
|
|
@@ -419,9 +438,9 @@ function convertTreeNode(node) {
|
|
|
419
438
|
return {
|
|
420
439
|
type: type_1.RType.String,
|
|
421
440
|
location: range,
|
|
422
|
-
content: convert_values_1.RStringValue.fromRLexeme(
|
|
423
|
-
lexeme:
|
|
424
|
-
...defaultInfo
|
|
441
|
+
content: convert_values_1.RStringValue.fromRLexeme(text()),
|
|
442
|
+
lexeme: text(),
|
|
443
|
+
...defaultInfo()
|
|
425
444
|
};
|
|
426
445
|
case tree_sitter_types_1.TreeSitterType.Float:
|
|
427
446
|
case tree_sitter_types_1.TreeSitterType.Integer:
|
|
@@ -431,32 +450,32 @@ function convertTreeNode(node) {
|
|
|
431
450
|
return {
|
|
432
451
|
type: type_1.RType.Number,
|
|
433
452
|
location: range,
|
|
434
|
-
content: convert_values_1.RNumberValue.fromRLexeme(
|
|
435
|
-
lexeme:
|
|
436
|
-
...defaultInfo
|
|
453
|
+
content: convert_values_1.RNumberValue.fromRLexeme(text()),
|
|
454
|
+
lexeme: text(),
|
|
455
|
+
...defaultInfo()
|
|
437
456
|
};
|
|
438
457
|
case tree_sitter_types_1.TreeSitterType.True:
|
|
439
458
|
case tree_sitter_types_1.TreeSitterType.False:
|
|
440
459
|
return {
|
|
441
460
|
type: type_1.RType.Logical,
|
|
442
461
|
location: range,
|
|
443
|
-
content:
|
|
444
|
-
lexeme:
|
|
445
|
-
...defaultInfo
|
|
462
|
+
content: text() === convert_values_1.RTrue,
|
|
463
|
+
lexeme: text(),
|
|
464
|
+
...defaultInfo()
|
|
446
465
|
};
|
|
447
466
|
case tree_sitter_types_1.TreeSitterType.Break:
|
|
448
467
|
return {
|
|
449
468
|
type: type_1.RType.Break,
|
|
450
469
|
location: range,
|
|
451
|
-
lexeme:
|
|
452
|
-
...defaultInfo
|
|
470
|
+
lexeme: text(),
|
|
471
|
+
...defaultInfo()
|
|
453
472
|
};
|
|
454
473
|
case tree_sitter_types_1.TreeSitterType.Next:
|
|
455
474
|
return {
|
|
456
475
|
type: type_1.RType.Next,
|
|
457
476
|
location: range,
|
|
458
|
-
lexeme:
|
|
459
|
-
...defaultInfo
|
|
477
|
+
lexeme: text(),
|
|
478
|
+
...defaultInfo()
|
|
460
479
|
};
|
|
461
480
|
case tree_sitter_types_1.TreeSitterType.Subset:
|
|
462
481
|
case tree_sitter_types_1.TreeSitterType.Subset2: {
|
|
@@ -474,7 +493,7 @@ function convertTreeNode(node) {
|
|
|
474
493
|
location: makeSourceRange(bracket),
|
|
475
494
|
lexeme: bracket.text,
|
|
476
495
|
info: {
|
|
477
|
-
...defaultInfo.info,
|
|
496
|
+
...defaultInfo().info,
|
|
478
497
|
adToks: argsComments.map(c => c[1]),
|
|
479
498
|
}
|
|
480
499
|
};
|
|
@@ -491,7 +510,7 @@ function convertTreeNode(node) {
|
|
|
491
510
|
name: undefined,
|
|
492
511
|
value: {
|
|
493
512
|
...convertTreeNode(rhs),
|
|
494
|
-
...defaultInfo
|
|
513
|
+
...defaultInfo()
|
|
495
514
|
},
|
|
496
515
|
location: rhsRange,
|
|
497
516
|
lexeme: rhs?.text,
|
|
@@ -504,7 +523,7 @@ function convertTreeNode(node) {
|
|
|
504
523
|
}],
|
|
505
524
|
location: makeSourceRange(operator),
|
|
506
525
|
lexeme: operator.text,
|
|
507
|
-
...defaultInfo
|
|
526
|
+
...defaultInfo()
|
|
508
527
|
};
|
|
509
528
|
}
|
|
510
529
|
case tree_sitter_types_1.TreeSitterType.Parameter: {
|
|
@@ -550,9 +569,9 @@ function convertTreeNode(node) {
|
|
|
550
569
|
name: undefined,
|
|
551
570
|
value: convertTreeNode(arg),
|
|
552
571
|
location: range,
|
|
553
|
-
lexeme:
|
|
572
|
+
lexeme: text(),
|
|
554
573
|
info: {
|
|
555
|
-
...defaultInfo.info,
|
|
574
|
+
...defaultInfo().info,
|
|
556
575
|
adToks: commentChildren.map(c => c[1]),
|
|
557
576
|
}
|
|
558
577
|
};
|
|
@@ -591,8 +610,8 @@ function convertTreeNode(node) {
|
|
|
591
610
|
return {
|
|
592
611
|
type: type_1.RType.Comment,
|
|
593
612
|
location: range,
|
|
594
|
-
lexeme:
|
|
595
|
-
...defaultInfo
|
|
613
|
+
lexeme: text(),
|
|
614
|
+
...defaultInfo()
|
|
596
615
|
};
|
|
597
616
|
case tree_sitter_types_1.TreeSitterType.Error:
|
|
598
617
|
return {
|
|
@@ -601,7 +620,7 @@ function convertTreeNode(node) {
|
|
|
601
620
|
lexeme: undefined,
|
|
602
621
|
children: [],
|
|
603
622
|
grouping: undefined,
|
|
604
|
-
...defaultInfo
|
|
623
|
+
...defaultInfo()
|
|
605
624
|
};
|
|
606
625
|
}
|
|
607
626
|
}
|
package/r-bridge/parser.js
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseRequests = parseRequests;
|
|
4
|
-
function countChildren(node) {
|
|
5
|
-
let ret = 1;
|
|
6
|
-
for (const child of node.children) {
|
|
7
|
-
ret += countChildren(child);
|
|
8
|
-
}
|
|
9
|
-
return ret;
|
|
10
|
-
}
|
|
11
4
|
/**
|
|
12
5
|
* Takes an input program and parses it using the given parser.
|
|
13
6
|
* @param _results - just a proxy for the pipeline, signifies that this function does not need prior knowledge of the pipeline
|
|
@@ -27,7 +20,7 @@ async function parseRequests(_results, input) {
|
|
|
27
20
|
parsed,
|
|
28
21
|
filePath: req.path,
|
|
29
22
|
'.parse-meta': typeof parsed === 'object' && 'rootNode' in parsed ? {
|
|
30
|
-
tokenCount:
|
|
23
|
+
tokenCount: parsed.rootNode.descendantCount,
|
|
31
24
|
} : undefined
|
|
32
25
|
});
|
|
33
26
|
}
|
|
@@ -42,7 +35,7 @@ async function parseRequests(_results, input) {
|
|
|
42
35
|
parsed,
|
|
43
36
|
filePath: r.path,
|
|
44
37
|
'.parse-meta': typeof parsed === 'object' && 'rootNode' in parsed ? {
|
|
45
|
-
tokenCount:
|
|
38
|
+
tokenCount: parsed.rootNode.descendantCount,
|
|
46
39
|
} : undefined
|
|
47
40
|
};
|
|
48
41
|
})
|
package/r-bridge/shell.d.ts
CHANGED
|
@@ -85,11 +85,18 @@ export declare class RShell implements AsyncParser<string> {
|
|
|
85
85
|
readonly name = "r-shell";
|
|
86
86
|
readonly async = true;
|
|
87
87
|
readonly options: Readonly<RShellOptions>;
|
|
88
|
-
private
|
|
88
|
+
private _session;
|
|
89
89
|
private readonly log;
|
|
90
90
|
private versionCache;
|
|
91
91
|
private tempDirs;
|
|
92
92
|
constructor(config?: RShellEngineConfig, options?: Partial<RShellOptions>);
|
|
93
|
+
/**
|
|
94
|
+
* The underlying R session, spawned on first access. Use {@link hasSession} to check whether
|
|
95
|
+
* the R process has actually been started without triggering a spawn (e.g. in {@link close}).
|
|
96
|
+
*/
|
|
97
|
+
private get session();
|
|
98
|
+
/** Whether the underlying R process has already been spawned. */
|
|
99
|
+
hasSession(): boolean;
|
|
93
100
|
parse(request: RParseRequest): Promise<string>;
|
|
94
101
|
information(): RShellInformation;
|
|
95
102
|
private revive;
|
package/r-bridge/shell.js
CHANGED
|
@@ -94,7 +94,7 @@ class RShell {
|
|
|
94
94
|
name = 'r-shell';
|
|
95
95
|
async = true;
|
|
96
96
|
options;
|
|
97
|
-
|
|
97
|
+
_session = undefined;
|
|
98
98
|
log;
|
|
99
99
|
versionCache = null;
|
|
100
100
|
// should never be more than one, but let's be sure
|
|
@@ -102,8 +102,23 @@ class RShell {
|
|
|
102
102
|
constructor(config, options) {
|
|
103
103
|
this.options = { ...getDefaultRShellOptions(config), ...options };
|
|
104
104
|
this.log = log_1.log.getSubLogger({ name: this.options.sessionName });
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
// the underlying R process is spawned lazily on first use (see the `session` getter),
|
|
106
|
+
// so merely constructing an RShell does not pay the cost of starting R.
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The underlying R session, spawned on first access. Use {@link hasSession} to check whether
|
|
110
|
+
* the R process has actually been started without triggering a spawn (e.g. in {@link close}).
|
|
111
|
+
*/
|
|
112
|
+
get session() {
|
|
113
|
+
if (this._session === undefined) {
|
|
114
|
+
this._session = new RShellSession(this.options, this.log);
|
|
115
|
+
this.revive();
|
|
116
|
+
}
|
|
117
|
+
return this._session;
|
|
118
|
+
}
|
|
119
|
+
/** Whether the underlying R process has already been spawned. */
|
|
120
|
+
hasSession() {
|
|
121
|
+
return this._session !== undefined;
|
|
107
122
|
}
|
|
108
123
|
parse(request) {
|
|
109
124
|
return (0, retriever_1.retrieveParseDataFromRCode)(request, this);
|
|
@@ -118,14 +133,14 @@ class RShell {
|
|
|
118
133
|
};
|
|
119
134
|
}
|
|
120
135
|
revive() {
|
|
121
|
-
if (this.options.revive === 0 /* RShellReviveOptions.Never */) {
|
|
136
|
+
if (this.options.revive === 0 /* RShellReviveOptions.Never */ || this._session === undefined) {
|
|
122
137
|
return;
|
|
123
138
|
}
|
|
124
|
-
this.
|
|
139
|
+
this._session.onExit((code, signal) => {
|
|
125
140
|
if (this.options.revive === 2 /* RShellReviveOptions.Always */ || (this.options.revive === 1 /* RShellReviveOptions.OnError */ && code !== 0)) {
|
|
126
141
|
this.log.warn(`R session exited with code ${code}, reviving!`);
|
|
127
142
|
this.options.onRevive(code, signal);
|
|
128
|
-
this.
|
|
143
|
+
this._session = new RShellSession(this.options, this.log);
|
|
129
144
|
this.revive();
|
|
130
145
|
}
|
|
131
146
|
});
|
|
@@ -248,7 +263,11 @@ class RShell {
|
|
|
248
263
|
* @returns true if the operation succeeds, false otherwise
|
|
249
264
|
*/
|
|
250
265
|
close() {
|
|
251
|
-
|
|
266
|
+
// if R was never spawned there is nothing to close - and we must not spawn it just to close it
|
|
267
|
+
if (this._session === undefined) {
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
return this._session.end([...this.tempDirs]);
|
|
252
271
|
}
|
|
253
272
|
_sendCommand(command) {
|
|
254
273
|
this.session.writeLine(command);
|
|
@@ -50,7 +50,7 @@ export declare const FlowrSearchGenerator: {
|
|
|
50
50
|
*/
|
|
51
51
|
readonly all: typeof all;
|
|
52
52
|
/**
|
|
53
|
-
* Returns all elements that match the given {@link
|
|
53
|
+
* Returns all elements that match the given {@link FlowrSearchGetFilter|filters}.
|
|
54
54
|
* You may pass a negative line number to count from the back.
|
|
55
55
|
* Please note that this is currently only working for single files, it approximates over the nodes, and it is not to be used for "production".
|
|
56
56
|
*/
|
|
@@ -132,7 +132,7 @@ export declare const Q: {
|
|
|
132
132
|
*/
|
|
133
133
|
readonly all: typeof all;
|
|
134
134
|
/**
|
|
135
|
-
* Returns all elements that match the given {@link
|
|
135
|
+
* Returns all elements that match the given {@link FlowrSearchGetFilter|filters}.
|
|
136
136
|
* You may pass a negative line number to count from the back.
|
|
137
137
|
* Please note that this is currently only working for single files, it approximates over the nodes, and it is not to be used for "production".
|
|
138
138
|
*/
|
|
@@ -46,7 +46,7 @@ exports.FlowrSearchGenerator = {
|
|
|
46
46
|
*/
|
|
47
47
|
all: all,
|
|
48
48
|
/**
|
|
49
|
-
* Returns all elements that match the given {@link
|
|
49
|
+
* Returns all elements that match the given {@link FlowrSearchGetFilter|filters}.
|
|
50
50
|
* You may pass a negative line number to count from the back.
|
|
51
51
|
* Please note that this is currently only working for single files, it approximates over the nodes, and it is not to be used for "production".
|
|
52
52
|
*/
|
|
@@ -2,9 +2,10 @@ import { RType } from '../r-bridge/lang-4.x/ast/model/type';
|
|
|
2
2
|
import { VertexType } from '../dataflow/graph/vertex';
|
|
3
3
|
import type { ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
4
4
|
import type { FlowrSearchElement } from './flowr-search';
|
|
5
|
-
import { Enrichment } from './search-executor/search-enrichers';
|
|
5
|
+
import type { Enrichment } from './search-executor/search-enrichers';
|
|
6
6
|
import type { DataflowInformation } from '../dataflow/info';
|
|
7
7
|
import type { BuiltInProcName } from '../dataflow/environments/built-in-proc-name';
|
|
8
|
+
import type { RoleInParent } from '../r-bridge/lang-4.x/ast/model/processing/role';
|
|
8
9
|
export type FlowrFilterName = keyof typeof FlowrFilters;
|
|
9
10
|
interface FlowrFilterWithArgs<Filter extends FlowrFilterName, Args extends FlowrFilterArgs<Filter>> {
|
|
10
11
|
name: Filter;
|
|
@@ -27,6 +28,11 @@ export declare enum FlowrFilter {
|
|
|
27
28
|
* This filter accepts {@link OriginKindArgs}, which includes the {@link DataflowGraphVertexFunctionCall.origin} to match for, whether to match for every or some origins, and whether to include non-function-calls in the filtered query.
|
|
28
29
|
*/
|
|
29
30
|
OriginKind = "origin-kind",
|
|
31
|
+
/**
|
|
32
|
+
* Only returns search element whose {@link RoleInParent} matches a given {@link RoleInParent}.
|
|
33
|
+
* This filter accepts an object containing a `roleInParent` argument of type {@link RoleInParent}.
|
|
34
|
+
*/
|
|
35
|
+
RoleInParent = "role-in-parent",
|
|
30
36
|
/**
|
|
31
37
|
* Only returns search elements whose file path matches the given regular expression.
|
|
32
38
|
* This filter accepts {@link FilePathFilterArgs}, which includes the file path regex to test against.
|
|
@@ -42,16 +48,26 @@ export declare const ValidFlowrFiltersReverse: {
|
|
|
42
48
|
};
|
|
43
49
|
export declare const FlowrFilters: {
|
|
44
50
|
readonly "drop-empty-arguments": (e: FlowrSearchElement<ParentInformation>, _args: never) => boolean;
|
|
45
|
-
readonly "matches-enrichment": (e: FlowrSearchElement<ParentInformation>, args: MatchesEnrichmentArgs<Enrichment>) =>
|
|
51
|
+
readonly "matches-enrichment": (e: FlowrSearchElement<ParentInformation>, args: MatchesEnrichmentArgs<Enrichment>) => never;
|
|
46
52
|
readonly "origin-kind": (e: FlowrSearchElement<ParentInformation>, args: OriginKindArgs, data: {
|
|
47
53
|
dataflow: DataflowInformation;
|
|
48
54
|
}) => boolean;
|
|
55
|
+
readonly "role-in-parent": (e: FlowrSearchElement<ParentInformation>, { roleInParent }: {
|
|
56
|
+
roleInParent: RoleInParent;
|
|
57
|
+
}) => boolean;
|
|
49
58
|
readonly "file-path-filter": (e: FlowrSearchElement<ParentInformation>, args: FilePathFilterArgs) => boolean;
|
|
50
59
|
};
|
|
51
60
|
export type FlowrFilterArgs<F extends FlowrFilter> = typeof FlowrFilters[F] extends FlowrFilterFunction<infer Args> ? Args : never;
|
|
52
61
|
export interface MatchesEnrichmentArgs<E extends Enrichment> {
|
|
53
62
|
enrichment: E;
|
|
54
|
-
|
|
63
|
+
/**
|
|
64
|
+
* The object to test the enrichment value against, which should be a partial {@link EnrichmentElementContent} with each value to test for replaced by a {@link RegExp} or value to match against. The test will pass if the partial structure matches and the enrichment value at each {@link RegExp}, string or primitive location matches the corresponding regular expression. For array entries, {@link arrayMatch} determines whether every element in the array has to match the given expected value, or only some.
|
|
65
|
+
*/
|
|
66
|
+
test: Record<string, unknown>;
|
|
67
|
+
/**
|
|
68
|
+
* For array entries, the expected value in {@link test} is compared against each array entry in the real value. This property determines whether every element in the array has to match, or only some. If unset, this defaults to `some`.
|
|
69
|
+
*/
|
|
70
|
+
arrayMatch?: 'some' | 'every';
|
|
55
71
|
}
|
|
56
72
|
export interface OriginKindArgs {
|
|
57
73
|
origin: BuiltInProcName | RegExp;
|
|
@@ -87,9 +103,9 @@ type LeafVertexType = {
|
|
|
87
103
|
readonly type: 'vertex-type';
|
|
88
104
|
readonly value: VertexType;
|
|
89
105
|
};
|
|
90
|
-
type LeafSpecial = {
|
|
106
|
+
type LeafSpecial<F extends FlowrFilter = FlowrFilter> = {
|
|
91
107
|
readonly type: 'special';
|
|
92
|
-
readonly value: FlowrFilterName | FlowrFilterWithArgs<
|
|
108
|
+
readonly value: FlowrFilterName | FlowrFilterWithArgs<F, FlowrFilterArgs<F>>;
|
|
93
109
|
};
|
|
94
110
|
type Leaf = LeafRType | LeafVertexType | LeafSpecial;
|
|
95
111
|
type BooleanNode = BooleanBinaryNode<BooleanNode> | BooleanUnaryNode<BooleanNode> | Leaf;
|
|
@@ -102,16 +118,21 @@ type BooleanNodeOrCombinator = BooleanNode | FlowrFilterCombinator;
|
|
|
102
118
|
export declare class FlowrFilterCombinator {
|
|
103
119
|
private tree;
|
|
104
120
|
protected constructor(init: BooleanNodeOrCombinator);
|
|
105
|
-
static is(value: BooleanNodeOrCombinator | ValidFilterTypes): FlowrFilterCombinator;
|
|
106
|
-
and(right: BooleanNodeOrCombinator | ValidFilterTypes):
|
|
107
|
-
or(right: BooleanNodeOrCombinator | ValidFilterTypes):
|
|
108
|
-
xor(right: BooleanNodeOrCombinator | ValidFilterTypes):
|
|
121
|
+
static is<F extends FlowrFilter = FlowrFilter>(value: BooleanNodeOrCombinator | ValidFilterTypes<F>): FlowrFilterCombinator;
|
|
122
|
+
static and<FLeft extends FlowrFilter = FlowrFilter, FRight extends FlowrFilter = FlowrFilter>(left: BooleanNodeOrCombinator | ValidFilterTypes<FLeft>, right: BooleanNodeOrCombinator | ValidFilterTypes<FRight>): FlowrFilterCombinator;
|
|
123
|
+
static or<FLeft extends FlowrFilter = FlowrFilter, FRight extends FlowrFilter = FlowrFilter>(left: BooleanNodeOrCombinator | ValidFilterTypes<FLeft>, right: BooleanNodeOrCombinator | ValidFilterTypes<FRight>): FlowrFilterCombinator;
|
|
124
|
+
static xor<FLeft extends FlowrFilter = FlowrFilter, FRight extends FlowrFilter = FlowrFilter>(left: BooleanNodeOrCombinator | ValidFilterTypes<FLeft>, right: BooleanNodeOrCombinator | ValidFilterTypes<FRight>): FlowrFilterCombinator;
|
|
125
|
+
static not<F extends FlowrFilter = FlowrFilter>(value: BooleanNodeOrCombinator | ValidFilterTypes<F>): FlowrFilterCombinator;
|
|
126
|
+
and<F extends FlowrFilter = FlowrFilter>(right: BooleanNodeOrCombinator | ValidFilterTypes<F>): this;
|
|
127
|
+
or<F extends FlowrFilter = FlowrFilter>(right: BooleanNodeOrCombinator | ValidFilterTypes<F>): this;
|
|
128
|
+
xor<F extends FlowrFilter = FlowrFilter>(right: BooleanNodeOrCombinator | ValidFilterTypes<F>): this;
|
|
109
129
|
private binaryRight;
|
|
110
130
|
not(): this;
|
|
111
131
|
private unary;
|
|
112
132
|
private unpack;
|
|
113
133
|
get(): BooleanNode;
|
|
114
134
|
}
|
|
135
|
+
export declare const F: typeof FlowrFilterCombinator;
|
|
115
136
|
/**
|
|
116
137
|
* Converts the given binary tree to a string representation.
|
|
117
138
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FlowrFilterCombinator = exports.FlowrFilters = exports.ValidFlowrFiltersReverse = exports.ValidFlowrFilters = exports.FlowrFilter = void 0;
|
|
3
|
+
exports.F = exports.FlowrFilterCombinator = exports.FlowrFilters = exports.ValidFlowrFiltersReverse = exports.ValidFlowrFilters = exports.FlowrFilter = void 0;
|
|
4
4
|
exports.testFunctionsIgnoringPackage = testFunctionsIgnoringPackage;
|
|
5
5
|
exports.binaryTreeToString = binaryTreeToString;
|
|
6
6
|
exports.isBinaryTree = isBinaryTree;
|
|
@@ -8,7 +8,8 @@ exports.evalFilter = evalFilter;
|
|
|
8
8
|
const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
|
|
9
9
|
const vertex_1 = require("../dataflow/graph/vertex");
|
|
10
10
|
const search_enrichers_1 = require("./search-executor/search-enrichers");
|
|
11
|
-
const
|
|
11
|
+
const objects_1 = require("../util/objects");
|
|
12
|
+
const search_generators_1 = require("./search-executor/search-generators");
|
|
12
13
|
var FlowrFilter;
|
|
13
14
|
(function (FlowrFilter) {
|
|
14
15
|
/**
|
|
@@ -27,6 +28,11 @@ var FlowrFilter;
|
|
|
27
28
|
* This filter accepts {@link OriginKindArgs}, which includes the {@link DataflowGraphVertexFunctionCall.origin} to match for, whether to match for every or some origins, and whether to include non-function-calls in the filtered query.
|
|
28
29
|
*/
|
|
29
30
|
FlowrFilter["OriginKind"] = "origin-kind";
|
|
31
|
+
/**
|
|
32
|
+
* Only returns search element whose {@link RoleInParent} matches a given {@link RoleInParent}.
|
|
33
|
+
* This filter accepts an object containing a `roleInParent` argument of type {@link RoleInParent}.
|
|
34
|
+
*/
|
|
35
|
+
FlowrFilter["RoleInParent"] = "role-in-parent";
|
|
30
36
|
/**
|
|
31
37
|
* Only returns search elements whose file path matches the given regular expression.
|
|
32
38
|
* This filter accepts {@link FilePathFilterArgs}, which includes the file path regex to test against.
|
|
@@ -40,25 +46,8 @@ exports.FlowrFilters = {
|
|
|
40
46
|
return e.node.type !== type_1.RType.Argument || e.node.name !== undefined;
|
|
41
47
|
}),
|
|
42
48
|
[FlowrFilter.MatchesEnrichment]: ((e, args) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (c === undefined || c.targets === undefined) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
for (const fn of c.targets) {
|
|
49
|
-
if (typeof fn === 'string' && args.test.test(fn)) {
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
if (typeof fn === 'object' && 'node' in fn && fn.node.type === type_1.RType.FunctionCall && fn.node.named && args.test.test(identifier_1.Identifier.getName(fn.node.functionName.content))) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
const content = JSON.stringify((0, search_enrichers_1.enrichmentContent)(e, args.enrichment));
|
|
60
|
-
return content !== undefined && args.test.test(content);
|
|
61
|
-
}
|
|
49
|
+
const content = (0, search_enrichers_1.enrichmentContent)(e, args.enrichment);
|
|
50
|
+
return content && (0, objects_1.looselyCompareObjects)(content, args.test, args.arrayMatch, search_generators_1.searchLogger);
|
|
62
51
|
}),
|
|
63
52
|
[FlowrFilter.OriginKind]: ((e, args, data) => {
|
|
64
53
|
const dfgNode = data.dataflow.graph.getVertex(e.node.info.id);
|
|
@@ -71,6 +60,9 @@ exports.FlowrFilters = {
|
|
|
71
60
|
const origins = Array.isArray(dfgNode.origin) ? dfgNode.origin : [dfgNode.origin];
|
|
72
61
|
return args.matchType === 'every' ? origins.every(match) : origins.some(match);
|
|
73
62
|
}),
|
|
63
|
+
[FlowrFilter.RoleInParent]: ((e, { roleInParent }) => {
|
|
64
|
+
return e.node.info.role === roleInParent;
|
|
65
|
+
}),
|
|
74
66
|
[FlowrFilter.FilePathFilter]: ((e, args) => {
|
|
75
67
|
const file = e.node.info.file;
|
|
76
68
|
const rx = args.filePathRegex instanceof RegExp ? args.filePathRegex : new RegExp(args.filePathRegex);
|
|
@@ -116,6 +108,18 @@ class FlowrFilterCombinator {
|
|
|
116
108
|
throw new Error(`Invalid filter value: ${value}`);
|
|
117
109
|
}
|
|
118
110
|
}
|
|
111
|
+
static and(left, right) {
|
|
112
|
+
return FlowrFilterCombinator.is(left).and(right);
|
|
113
|
+
}
|
|
114
|
+
static or(left, right) {
|
|
115
|
+
return FlowrFilterCombinator.is(left).or(right);
|
|
116
|
+
}
|
|
117
|
+
static xor(left, right) {
|
|
118
|
+
return FlowrFilterCombinator.is(left).xor(right);
|
|
119
|
+
}
|
|
120
|
+
static not(value) {
|
|
121
|
+
return FlowrFilterCombinator.is(value).not();
|
|
122
|
+
}
|
|
119
123
|
and(right) {
|
|
120
124
|
return this.binaryRight('and', right);
|
|
121
125
|
}
|
|
@@ -151,6 +155,7 @@ class FlowrFilterCombinator {
|
|
|
151
155
|
}
|
|
152
156
|
}
|
|
153
157
|
exports.FlowrFilterCombinator = FlowrFilterCombinator;
|
|
158
|
+
exports.F = FlowrFilterCombinator;
|
|
154
159
|
/**
|
|
155
160
|
* Converts the given binary tree to a string representation.
|
|
156
161
|
*/
|