@eagleoutice/flowr 2.10.5 → 2.10.6

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 (77) hide show
  1. package/README.md +20 -20
  2. package/abstract-interpretation/absint-visitor.d.ts +1 -2
  3. package/abstract-interpretation/domains/state-domain-like.d.ts +2 -2
  4. package/config.d.ts +6 -0
  5. package/config.js +2 -0
  6. package/control-flow/basic-cfg-guided-visitor.d.ts +1 -1
  7. package/control-flow/semantic-cfg-guided-visitor.js +3 -0
  8. package/dataflow/environments/built-in-proc-name.d.ts +7 -1
  9. package/dataflow/environments/built-in-proc-name.js +6 -0
  10. package/dataflow/environments/built-in.d.ts +6 -0
  11. package/dataflow/environments/built-in.js +6 -0
  12. package/dataflow/environments/default-builtin-config.d.ts +53 -1
  13. package/dataflow/environments/default-builtin-config.js +13 -3
  14. package/dataflow/environments/identifier.d.ts +14 -0
  15. package/dataflow/graph/vertex.d.ts +6 -0
  16. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +16 -0
  17. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +6 -0
  18. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +99 -2
  19. package/dataflow/internal/process/functions/call/built-in/built-in-attach.d.ts +13 -0
  20. package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +48 -0
  21. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +75 -0
  22. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +196 -0
  23. package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +5 -0
  24. package/dataflow/internal/process/functions/call/built-in/built-in-get.js +27 -13
  25. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +14 -4
  26. package/dataflow/internal/process/functions/call/built-in/built-in-new-env.d.ts +27 -0
  27. package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +97 -0
  28. package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +23 -0
  29. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +90 -0
  30. package/documentation/doc-util/doc-types.d.ts +11 -2
  31. package/documentation/doc-util/doc-types.js +31 -9
  32. package/documentation/wiki-absint.d.ts +16 -0
  33. package/documentation/wiki-absint.js +50 -15
  34. package/documentation/wiki-interface.js +1 -0
  35. package/documentation/wiki-mk/doc-context.d.ts +14 -1
  36. package/documentation/wiki-mk/doc-context.js +6 -0
  37. package/documentation/wiki-normalized-ast.d.ts +0 -9
  38. package/documentation/wiki-normalized-ast.js +9 -60
  39. package/linter/linter-rules.d.ts +2 -1
  40. package/linter/rules/problematic-inputs.d.ts +9 -4
  41. package/linter/rules/problematic-inputs.js +108 -58
  42. package/package.json +1 -1
  43. package/queries/catalog/dependencies-query/function-info/read-functions.js +2 -0
  44. package/queries/catalog/dependencies-query/function-info/write-functions.js +1 -0
  45. package/queries/catalog/input-sources-query/input-source-functions.d.ts +1 -0
  46. package/queries/catalog/input-sources-query/input-source-functions.js +7 -1
  47. package/queries/catalog/input-sources-query/input-sources-query-format.js +3 -1
  48. package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +3 -1
  49. package/queries/catalog/input-sources-query/simple-input-classifier.js +3 -1
  50. package/r-bridge/data/data.d.ts +28 -2
  51. package/r-bridge/data/data.js +34 -2
  52. package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -2
  53. package/r-bridge/lang-4.x/ast/model/model.js +0 -1
  54. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +3 -3
  55. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -3
  56. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -3
  57. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +3 -3
  58. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +3 -3
  59. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +3 -3
  60. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +3 -3
  61. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +3 -3
  62. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +3 -3
  63. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +3 -3
  64. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +3 -3
  65. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +3 -3
  66. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +3 -3
  67. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -3
  68. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +3 -3
  69. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +3 -3
  70. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +3 -3
  71. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -3
  72. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +3 -3
  73. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -3
  74. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +3 -3
  75. package/util/version.js +1 -1
  76. package/abstract-interpretation/normalized-ast-fold.d.ts +0 -119
  77. package/abstract-interpretation/normalized-ast-fold.js +0 -181
@@ -1,119 +0,0 @@
1
- import type { NoInfo, RNode } from '../r-bridge/lang-4.x/ast/model/model';
2
- import type { RExpressionList } from '../r-bridge/lang-4.x/ast/model/nodes/r-expression-list';
3
- import { type RFunctionCall, EmptyArgument } from '../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
4
- import type { RFunctionDefinition } from '../r-bridge/lang-4.x/ast/model/nodes/r-function-definition';
5
- import { RType } from '../r-bridge/lang-4.x/ast/model/type';
6
- import type { RForLoop } from '../r-bridge/lang-4.x/ast/model/nodes/r-for-loop';
7
- import type { RWhileLoop } from '../r-bridge/lang-4.x/ast/model/nodes/r-while-loop';
8
- import type { RRepeatLoop } from '../r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop';
9
- import type { RIfThenElse } from '../r-bridge/lang-4.x/ast/model/nodes/r-if-then-else';
10
- import type { RBinaryOp } from '../r-bridge/lang-4.x/ast/model/nodes/r-binary-op';
11
- import type { RPipe } from '../r-bridge/lang-4.x/ast/model/nodes/r-pipe';
12
- import type { RUnaryOp } from '../r-bridge/lang-4.x/ast/model/nodes/r-unary-op';
13
- import type { RParameter } from '../r-bridge/lang-4.x/ast/model/nodes/r-parameter';
14
- import type { RArgument } from '../r-bridge/lang-4.x/ast/model/nodes/r-argument';
15
- import { RAccess } from '../r-bridge/lang-4.x/ast/model/nodes/r-access';
16
- import type { RLogical } from '../r-bridge/lang-4.x/ast/model/nodes/r-logical';
17
- import type { RBreak } from '../r-bridge/lang-4.x/ast/model/nodes/r-break';
18
- import type { RComment } from '../r-bridge/lang-4.x/ast/model/nodes/r-comment';
19
- import type { RNext } from '../r-bridge/lang-4.x/ast/model/nodes/r-next';
20
- import type { RNumber } from '../r-bridge/lang-4.x/ast/model/nodes/r-number';
21
- import type { RLineDirective } from '../r-bridge/lang-4.x/ast/model/nodes/r-line-directive';
22
- import type { RString } from '../r-bridge/lang-4.x/ast/model/nodes/r-string';
23
- import type { RSymbol } from '../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
24
- import { RProject } from '../r-bridge/lang-4.x/ast/model/nodes/r-project';
25
- type FoldOfType<T extends RType, Returns = void, Info = NoInfo> = (node: Extract<RNode<Info>, {
26
- type: T;
27
- }>) => Returns;
28
- /** explicitly excludes types that are not visitable */
29
- export type FoldableRType = Exclude<RType, RType.Delimiter | RType.Project>;
30
- /**
31
- * Describes the fold functions for each node type.
32
- */
33
- export type NormalizedAstFold<Returns = void, Info = NoInfo> = {
34
- [K in FoldableRType as `fold${Capitalize<K>}`]: FoldOfType<K, Returns, Info>;
35
- };
36
- /**
37
- * Describes the type of a mapping object,
38
- * which maps the type of the normalized AST node to the corresponding fold function.
39
- */
40
- export type FittingNormalizedAstFold<Returns = void, Info = NoInfo> = Readonly<{
41
- [K in FoldableRType]: FoldOfType<K, Returns, Info>;
42
- }>;
43
- export type SingleOrArrayOrNothing<T> = T | readonly (T | null | undefined)[] | null | undefined;
44
- export type EntryExitVisitor<Info> = ((node: RNode<Info>) => void) | undefined;
45
- /**
46
- * Default implementation of a fold over the normalized AST (using the classic fold traversal).
47
- * To modify the behavior, please extend this class and overwrite the methods of interest.
48
- * You can control the value passing (`Returns` generic)
49
- * by providing sensible Monoid behavior overwriting the {@link DefaultNormalizedAstFold#concat|concat} method
50
- * and supplying the empty value in the constructor.
51
- * @note By providing `entry` and `exit` you can use this as an extension to the simpler {@link visitAst} function but without
52
- * the early termination within the visitors (for this, you can overwrite the respective `fold*` methods).
53
- * @example First you want to create your own fold:
54
- *
55
- * ```ts
56
- * let marker = false;
57
- * class MyNumberFold<Info> extends DefaultNormalizedAstFold<void, Info> {
58
- * override foldRNumber(node: RNumber<Info>) {
59
- * super.foldRNumber(node);
60
- * marker = true;
61
- * }
62
- * }
63
- * ```
64
- * This one does explicitly not use the return functionality (and hence acts more as a conventional visitor).
65
- * Now let us suppose we have a normalized AST as an {@link RNode} in the variable `ast`
66
- * and want to check if the AST contains a number:
67
- *
68
- * ```ts
69
- * const result = new MyNumberFold().fold(ast);
70
- * ```
71
- *
72
- * Please take a look at the corresponding tests or the wiki pages for more information on how to use this fold.
73
- */
74
- export declare class DefaultNormalizedAstFold<Returns = void, Info = NoInfo> implements NormalizedAstFold<Returns, Info> {
75
- protected readonly enter: EntryExitVisitor<Info>;
76
- protected readonly exit: EntryExitVisitor<Info>;
77
- protected readonly empty: Returns;
78
- /**
79
- * Empty must provide a sensible default whenever you want to have `Returns` as non-`void`
80
- * (e.g., whenever you want your visitors to be able to return a value).
81
- */
82
- constructor(empty: Returns, enter?: EntryExitVisitor<Info>, exit?: EntryExitVisitor<Info>);
83
- /**
84
- * Monoid::concat
85
- * @see {@link https://en.wikipedia.org/wiki/Monoid}
86
- * @see {@link DefaultNormalizedAstFold#concatAll|concatAll}
87
- */
88
- protected concat(_a: Returns, _b: Returns): Returns;
89
- /**
90
- * overwrite this method, if you have a faster way to concat multiple nodes
91
- * @see {@link DefaultNormalizedAstFold#concatAll|concatAll}
92
- */
93
- protected concatAll(nodes: readonly Returns[]): Returns;
94
- fold(nodes: SingleOrArrayOrNothing<RNode<Info> | typeof EmptyArgument | RProject<Info>>): Returns;
95
- protected foldSingle(node: RNode<Info>): Returns;
96
- foldRAccess(access: RAccess<Info>): Returns;
97
- foldRArgument(argument: RArgument<Info>): Returns;
98
- foldRBinaryOp(binaryOp: RBinaryOp<Info>): Returns;
99
- foldRExpressionList(exprList: RExpressionList<Info>): Returns;
100
- foldRForLoop(loop: RForLoop<Info>): Returns;
101
- foldRFunctionCall(call: RFunctionCall<Info>): Returns;
102
- foldRFunctionDefinition(definition: RFunctionDefinition<Info>): Returns;
103
- foldRIfThenElse(ite: RIfThenElse<Info>): Returns;
104
- foldRParameter(parameter: RParameter<Info>): Returns;
105
- foldRPipe(pipe: RPipe<Info>): Returns;
106
- foldRRepeatLoop(loop: RRepeatLoop<Info>): Returns;
107
- foldRUnaryOp(unaryOp: RUnaryOp<Info>): Returns;
108
- foldRWhileLoop(loop: RWhileLoop<Info>): Returns;
109
- foldRBreak(_node: RBreak<Info>): Returns;
110
- foldRComment(_node: RComment<Info>): Returns;
111
- foldRLineDirective(_node: RLineDirective<Info>): Returns;
112
- foldRLogical(_node: RLogical<Info>): Returns;
113
- foldRNext(_node: RNext<Info>): Returns;
114
- foldRNumber(_node: RNumber<Info>): Returns;
115
- foldRString(_node: RString<Info>): Returns;
116
- foldRSymbol(_node: RSymbol<Info>): Returns;
117
- protected readonly folds: FittingNormalizedAstFold<Returns, Info>;
118
- }
119
- export {};
@@ -1,181 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefaultNormalizedAstFold = void 0;
4
- const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
5
- const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
6
- const r_access_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-access");
7
- const r_project_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-project");
8
- /**
9
- * Default implementation of a fold over the normalized AST (using the classic fold traversal).
10
- * To modify the behavior, please extend this class and overwrite the methods of interest.
11
- * You can control the value passing (`Returns` generic)
12
- * by providing sensible Monoid behavior overwriting the {@link DefaultNormalizedAstFold#concat|concat} method
13
- * and supplying the empty value in the constructor.
14
- * @note By providing `entry` and `exit` you can use this as an extension to the simpler {@link visitAst} function but without
15
- * the early termination within the visitors (for this, you can overwrite the respective `fold*` methods).
16
- * @example First you want to create your own fold:
17
- *
18
- * ```ts
19
- * let marker = false;
20
- * class MyNumberFold<Info> extends DefaultNormalizedAstFold<void, Info> {
21
- * override foldRNumber(node: RNumber<Info>) {
22
- * super.foldRNumber(node);
23
- * marker = true;
24
- * }
25
- * }
26
- * ```
27
- * This one does explicitly not use the return functionality (and hence acts more as a conventional visitor).
28
- * Now let us suppose we have a normalized AST as an {@link RNode} in the variable `ast`
29
- * and want to check if the AST contains a number:
30
- *
31
- * ```ts
32
- * const result = new MyNumberFold().fold(ast);
33
- * ```
34
- *
35
- * Please take a look at the corresponding tests or the wiki pages for more information on how to use this fold.
36
- */
37
- class DefaultNormalizedAstFold {
38
- enter;
39
- exit;
40
- empty;
41
- /**
42
- * Empty must provide a sensible default whenever you want to have `Returns` as non-`void`
43
- * (e.g., whenever you want your visitors to be able to return a value).
44
- */
45
- constructor(empty, enter, exit) {
46
- this.empty = empty;
47
- this.enter = enter;
48
- this.exit = exit;
49
- }
50
- /**
51
- * Monoid::concat
52
- * @see {@link https://en.wikipedia.org/wiki/Monoid}
53
- * @see {@link DefaultNormalizedAstFold#concatAll|concatAll}
54
- */
55
- concat(_a, _b) {
56
- return this.empty;
57
- }
58
- /**
59
- * overwrite this method, if you have a faster way to concat multiple nodes
60
- * @see {@link DefaultNormalizedAstFold#concatAll|concatAll}
61
- */
62
- concatAll(nodes) {
63
- return nodes.reduce((acc, n) => this.concat(acc, n), this.empty);
64
- }
65
- fold(nodes) {
66
- if (Array.isArray(nodes)) {
67
- const n = nodes;
68
- return this.concatAll(n.filter(n => n && n !== r_function_call_1.EmptyArgument)
69
- .map(node => r_project_1.RProject.is(node) ?
70
- this.concatAll(node.files.map(f => this.foldSingle(f.root))) :
71
- this.foldSingle(node)));
72
- }
73
- else if (nodes) {
74
- if (r_project_1.RProject.is(nodes)) {
75
- return this.concatAll(nodes.files.map(f => this.foldSingle(f.root)));
76
- }
77
- return this.foldSingle(nodes);
78
- }
79
- return this.empty;
80
- }
81
- foldSingle(node) {
82
- this.enter?.(node);
83
- const type = node.type;
84
- // @ts-expect-error -- ts may be unable to infer that the type is correct
85
- const result = this.folds[type]?.(node);
86
- this.exit?.(node);
87
- return result;
88
- }
89
- foldRAccess(access) {
90
- let accessed = this.foldSingle(access.accessed);
91
- if (r_access_1.RAccess.isIndex(access)) {
92
- accessed = this.concat(accessed, this.fold(access.access));
93
- }
94
- return accessed;
95
- }
96
- foldRArgument(argument) {
97
- return this.concat(this.fold(argument.name), this.fold(argument.value));
98
- }
99
- foldRBinaryOp(binaryOp) {
100
- return this.concat(this.foldSingle(binaryOp.lhs), this.foldSingle(binaryOp.rhs));
101
- }
102
- foldRExpressionList(exprList) {
103
- return this.concat(this.fold(exprList.grouping), this.fold(exprList.children));
104
- }
105
- foldRForLoop(loop) {
106
- return this.concatAll([this.foldSingle(loop.variable), this.foldSingle(loop.vector), this.foldSingle(loop.body)]);
107
- }
108
- foldRFunctionCall(call) {
109
- return this.concat(this.foldSingle(call.named ? call.functionName : call.calledFunction), this.fold(call.arguments));
110
- }
111
- foldRFunctionDefinition(definition) {
112
- return this.concat(this.fold(definition.parameters), this.foldSingle(definition.body));
113
- }
114
- foldRIfThenElse(ite) {
115
- return this.concatAll([this.foldSingle(ite.condition), this.foldSingle(ite.then), this.fold(ite.otherwise)]);
116
- }
117
- foldRParameter(parameter) {
118
- return this.concat(this.foldSingle(parameter.name), this.fold(parameter.defaultValue));
119
- }
120
- foldRPipe(pipe) {
121
- return this.concat(this.foldSingle(pipe.lhs), this.foldSingle(pipe.rhs));
122
- }
123
- foldRRepeatLoop(loop) {
124
- return this.foldSingle(loop.body);
125
- }
126
- foldRUnaryOp(unaryOp) {
127
- return this.foldSingle(unaryOp.operand);
128
- }
129
- foldRWhileLoop(loop) {
130
- return this.concat(this.foldSingle(loop.condition), this.foldSingle(loop.body));
131
- }
132
- foldRBreak(_node) {
133
- return this.empty;
134
- }
135
- foldRComment(_node) {
136
- return this.empty;
137
- }
138
- foldRLineDirective(_node) {
139
- return this.empty;
140
- }
141
- foldRLogical(_node) {
142
- return this.empty;
143
- }
144
- foldRNext(_node) {
145
- return this.empty;
146
- }
147
- foldRNumber(_node) {
148
- return this.empty;
149
- }
150
- foldRString(_node) {
151
- return this.empty;
152
- }
153
- foldRSymbol(_node) {
154
- return this.empty;
155
- }
156
- folds = {
157
- [type_1.RType.Access]: n => this.foldRAccess(n),
158
- [type_1.RType.Argument]: n => this.foldRArgument(n),
159
- [type_1.RType.BinaryOp]: n => this.foldRBinaryOp(n),
160
- [type_1.RType.Break]: n => this.foldRBreak(n),
161
- [type_1.RType.Comment]: n => this.foldRComment(n),
162
- [type_1.RType.ExpressionList]: n => this.foldRExpressionList(n),
163
- [type_1.RType.ForLoop]: n => this.foldRForLoop(n),
164
- [type_1.RType.FunctionCall]: n => this.foldRFunctionCall(n),
165
- [type_1.RType.FunctionDefinition]: n => this.foldRFunctionDefinition(n),
166
- [type_1.RType.IfThenElse]: n => this.foldRIfThenElse(n),
167
- [type_1.RType.LineDirective]: n => this.foldRLineDirective(n),
168
- [type_1.RType.Logical]: n => this.foldRLogical(n),
169
- [type_1.RType.Next]: n => this.foldRNext(n),
170
- [type_1.RType.Number]: n => this.foldRNumber(n),
171
- [type_1.RType.Parameter]: n => this.foldRParameter(n),
172
- [type_1.RType.Pipe]: n => this.foldRPipe(n),
173
- [type_1.RType.RepeatLoop]: n => this.foldRRepeatLoop(n),
174
- [type_1.RType.String]: n => this.foldRString(n),
175
- [type_1.RType.Symbol]: n => this.foldRSymbol(n),
176
- [type_1.RType.UnaryOp]: n => this.foldRUnaryOp(n),
177
- [type_1.RType.WhileLoop]: n => this.foldRWhileLoop(n),
178
- };
179
- }
180
- exports.DefaultNormalizedAstFold = DefaultNormalizedAstFold;
181
- //# sourceMappingURL=normalized-ast-fold.js.map