@eagleoutice/flowr 2.9.9 → 2.9.11

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 (198) hide show
  1. package/README.md +57 -54
  2. package/abstract-interpretation/absint-visitor.d.ts +16 -14
  3. package/abstract-interpretation/absint-visitor.js +93 -47
  4. package/abstract-interpretation/data-frame/mappers/arguments.d.ts +1 -1
  5. package/abstract-interpretation/data-frame/mappers/arguments.js +2 -2
  6. package/abstract-interpretation/data-frame/shape-inference.d.ts +2 -5
  7. package/abstract-interpretation/data-frame/shape-inference.js +4 -5
  8. package/abstract-interpretation/domains/abstract-domain.d.ts +4 -4
  9. package/abstract-interpretation/domains/abstract-domain.js +8 -8
  10. package/abstract-interpretation/domains/mapped-abstract-domain.d.ts +12 -5
  11. package/abstract-interpretation/domains/mapped-abstract-domain.js +47 -23
  12. package/abstract-interpretation/domains/set-range-domain.js +1 -1
  13. package/abstract-interpretation/domains/state-abstract-domain.d.ts +30 -1
  14. package/abstract-interpretation/domains/state-abstract-domain.js +130 -4
  15. package/abstract-interpretation/normalized-ast-fold.d.ts +2 -2
  16. package/abstract-interpretation/normalized-ast-fold.js +4 -3
  17. package/benchmark/slicer.js +5 -5
  18. package/benchmark/summarizer/first-phase/process.js +4 -4
  19. package/cli/repl/commands/repl-normalize.js +2 -2
  20. package/cli/repl/core.js +2 -2
  21. package/config.js +1 -1
  22. package/control-flow/cfg-simplification.d.ts +1 -0
  23. package/control-flow/cfg-simplification.js +1 -0
  24. package/control-flow/control-flow-graph.d.ts +1 -1
  25. package/control-flow/control-flow-graph.js +1 -2
  26. package/control-flow/extract-cfg.js +34 -15
  27. package/control-flow/semantic-cfg-guided-visitor.js +1 -0
  28. package/dataflow/cluster.js +1 -1
  29. package/dataflow/environments/built-in.d.ts +6 -15
  30. package/dataflow/environments/built-in.js +25 -33
  31. package/dataflow/environments/default-builtin-config.d.ts +4 -8
  32. package/dataflow/environments/default-builtin-config.js +8 -5
  33. package/dataflow/environments/reference-to-maybe.d.ts +8 -0
  34. package/dataflow/environments/reference-to-maybe.js +46 -3
  35. package/dataflow/eval/resolve/alias-tracking.d.ts +2 -2
  36. package/dataflow/eval/resolve/alias-tracking.js +6 -6
  37. package/dataflow/eval/resolve/resolve.js +12 -10
  38. package/dataflow/fn/exceptions-of-function.d.ts +1 -1
  39. package/dataflow/fn/exceptions-of-function.js +2 -1
  40. package/dataflow/graph/call-graph.d.ts +1 -1
  41. package/dataflow/graph/call-graph.js +4 -3
  42. package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
  43. package/dataflow/graph/dataflowgraph-builder.js +21 -21
  44. package/dataflow/graph/graph.d.ts +5 -5
  45. package/dataflow/graph/graph.js +36 -32
  46. package/dataflow/graph/unknown-side-effect.js +3 -1
  47. package/dataflow/info.d.ts +4 -0
  48. package/dataflow/info.js +2 -2
  49. package/dataflow/internal/linker.d.ts +4 -4
  50. package/dataflow/internal/linker.js +59 -33
  51. package/dataflow/internal/process/functions/call/argument/make-argument.d.ts +2 -1
  52. package/dataflow/internal/process/functions/call/argument/make-argument.js +3 -1
  53. package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -1
  54. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -1
  55. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +3 -5
  56. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +1 -1
  57. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +6 -5
  58. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +15 -6
  59. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -1
  60. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +3 -2
  61. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -4
  62. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +3 -3
  63. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -2
  64. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -1
  65. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -1
  66. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +7 -7
  67. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +3 -3
  68. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +22 -11
  69. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +22 -19
  70. package/dataflow/internal/process/functions/call/common.d.ts +1 -1
  71. package/dataflow/internal/process/functions/call/common.js +43 -35
  72. package/dataflow/internal/process/functions/call/known-call-handling.js +0 -2
  73. package/dataflow/internal/process/functions/process-argument.d.ts +1 -1
  74. package/dataflow/internal/process/functions/process-argument.js +3 -3
  75. package/dataflow/internal/process/functions/process-parameter.js +2 -2
  76. package/dataflow/origin/dfg-get-origin.d.ts +1 -1
  77. package/dataflow/origin/dfg-get-origin.js +2 -2
  78. package/documentation/doc-util/doc-types.js +1 -1
  79. package/documentation/wiki-absint.js +7 -8
  80. package/documentation/wiki-cfg.js +3 -3
  81. package/documentation/wiki-mk/doc-context.d.ts +8 -0
  82. package/documentation/wiki-mk/doc-context.js +4 -0
  83. package/documentation/wiki-normalized-ast.d.ts +1 -1
  84. package/documentation/wiki-normalized-ast.js +9 -6
  85. package/linter/linter-format.d.ts +10 -0
  86. package/linter/linter-format.js +15 -0
  87. package/linter/rules/absolute-path.js +3 -3
  88. package/linter/rules/dead-code.js +1 -1
  89. package/linter/rules/file-path-validity.js +1 -1
  90. package/linter/rules/seeded-randomness.js +1 -1
  91. package/linter/rules/unused-definition.js +1 -1
  92. package/package.json +7 -7
  93. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +9 -0
  94. package/project/plugins/file-plugins/files/flowr-description-file.js +12 -0
  95. package/queries/catalog/call-context-query/call-context-query-executor.js +1 -1
  96. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +1 -1
  97. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +4 -5
  98. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -1
  99. package/queries/catalog/dependencies-query/dependencies-query-format.js +6 -5
  100. package/queries/catalog/df-shape-query/df-shape-query-format.d.ts +1 -1
  101. package/queries/catalog/df-shape-query/df-shape-query-format.js +3 -3
  102. package/queries/catalog/does-call-query/does-call-query-executor.js +3 -3
  103. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +1 -1
  104. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -2
  105. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +1 -1
  106. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -1
  107. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +1 -1
  108. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +1 -1
  109. package/queries/query-print.d.ts +1 -1
  110. package/queries/query-print.js +4 -3
  111. package/r-bridge/lang-4.x/ast/model/model.d.ts +151 -4
  112. package/r-bridge/lang-4.x/ast/model/model.js +249 -0
  113. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +11 -1
  114. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +13 -0
  115. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +19 -1
  116. package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +26 -0
  117. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +36 -3
  118. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +48 -13
  119. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +16 -1
  120. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +21 -0
  121. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +11 -1
  122. package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +14 -0
  123. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +8 -2
  124. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +11 -5
  125. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +23 -1
  126. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +32 -0
  127. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +11 -1
  128. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +14 -0
  129. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +19 -1
  130. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +26 -1
  131. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +11 -1
  132. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +14 -0
  133. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +11 -1
  134. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +14 -0
  135. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +12 -2
  136. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +14 -0
  137. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +20 -2
  138. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +26 -0
  139. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +12 -2
  140. package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +14 -0
  141. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +8 -2
  142. package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +11 -5
  143. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +17 -1
  144. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +22 -0
  145. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +16 -1
  146. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +22 -0
  147. package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +45 -8
  148. package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +57 -16
  149. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +12 -2
  150. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +14 -0
  151. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +15 -3
  152. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +21 -6
  153. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +21 -6
  154. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +22 -5
  155. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +16 -1
  156. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +21 -0
  157. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +11 -1
  158. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +14 -0
  159. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +23 -17
  160. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +39 -2
  161. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +52 -9
  162. package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +18 -17
  163. package/r-bridge/lang-4.x/ast/model/processing/visitor.d.ts +8 -7
  164. package/r-bridge/lang-4.x/ast/model/processing/visitor.js +6 -13
  165. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +1 -1
  166. package/r-bridge/lang-4.x/ast/parser/json/parser.js +1 -1
  167. package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +4 -2
  168. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -1
  169. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +2 -2
  170. package/r-bridge/lang-4.x/convert-values.d.ts +14 -5
  171. package/r-bridge/lang-4.x/convert-values.js +76 -72
  172. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +33 -15
  173. package/r-bridge/roxygen2/roxygen-parse.js +1 -1
  174. package/r-bridge/shell-executor.js +1 -1
  175. package/reconstruct/auto-select/magic-comments.js +4 -4
  176. package/reconstruct/reconstruct.js +2 -1
  177. package/search/search-executor/search-generators.js +2 -2
  178. package/slicing/criterion/filters/all-variables.js +1 -1
  179. package/slicing/criterion/parse.d.ts +1 -1
  180. package/slicing/criterion/parse.js +5 -3
  181. package/slicing/static/slice-call.d.ts +1 -1
  182. package/slicing/static/slice-call.js +2 -2
  183. package/statistics/features/supported/assignments/assignments.js +2 -2
  184. package/statistics/features/supported/control-flow/control-flow.js +2 -2
  185. package/statistics/features/supported/data-access/data-access.js +6 -5
  186. package/statistics/features/supported/defined-functions/defined-functions.js +9 -8
  187. package/statistics/features/supported/expression-list/statistics-expression-list.js +2 -2
  188. package/statistics/features/supported/loops/loops.js +6 -5
  189. package/statistics/features/supported/used-functions/used-functions.js +2 -2
  190. package/statistics/features/supported/variables/variables.js +8 -8
  191. package/util/mermaid/ast.js +3 -3
  192. package/util/mermaid/cfg.js +3 -4
  193. package/util/mermaid/dfg.d.ts +1 -1
  194. package/util/mermaid/dfg.js +13 -12
  195. package/util/simple-df/dfg-ascii.js +1 -1
  196. package/util/version.js +1 -1
  197. package/r-bridge/lang-4.x/ast/model/collect.d.ts +0 -10
  198. package/r-bridge/lang-4.x/ast/model/collect.js +0 -25
@@ -1,22 +1,57 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getArgumentWithId = getArgumentWithId;
3
+ exports.RArgument = void 0;
4
+ const type_1 = require("../type");
4
5
  const r_function_call_1 = require("./r-function-call");
5
6
  /**
6
- * Retrieve the argument with the given id from the list of arguments.
7
+ * Helper for working with {@link RArgument} AST nodes.
7
8
  */
8
- function getArgumentWithId(args, id) {
9
- if (id === undefined) {
10
- return undefined;
11
- }
12
- for (const arg of args) {
13
- if (arg === r_function_call_1.EmptyArgument) {
14
- continue;
9
+ exports.RArgument = {
10
+ name: 'RArgument',
11
+ /**
12
+ * Type guard for {@link RArgument} nodes.
13
+ * @see {@link RArgument.isUnnamed} - to check whether an argument is unnamed
14
+ */
15
+ is(node) {
16
+ return node?.type === type_1.RType.Argument;
17
+ },
18
+ /**
19
+ * Type guard for named arguments, i.e. arguments with a name.
20
+ */
21
+ isNamed(node) {
22
+ return exports.RArgument.is(node) && node.name !== undefined;
23
+ },
24
+ /**
25
+ * Type guard for unnamed arguments, i.e. arguments without a name.
26
+ */
27
+ isUnnamed(node) {
28
+ return exports.RArgument.is(node) && node.name === undefined && node.value !== undefined;
29
+ },
30
+ /**
31
+ * Type guard for arguments with a value, i.e. arguments that are not just placeholders without a value.
32
+ */
33
+ isWithValue(node) {
34
+ return exports.RArgument.is(node) && node.value !== undefined;
35
+ },
36
+ getWithId(args, id) {
37
+ if (id === undefined) {
38
+ return undefined;
15
39
  }
16
- if (arg.info.id === id) {
17
- return arg;
40
+ for (const arg of args) {
41
+ if (arg === r_function_call_1.EmptyArgument) {
42
+ continue;
43
+ }
44
+ if (arg.info.id === id) {
45
+ return arg;
46
+ }
18
47
  }
48
+ return undefined;
49
+ },
50
+ /**
51
+ * Retrieve the value of the argument with the given id from the list of arguments.
52
+ */
53
+ getValue(args, id) {
54
+ return exports.RArgument.getWithId(args, id)?.value;
19
55
  }
20
- return undefined;
21
- }
56
+ };
22
57
  //# sourceMappingURL=r-argument.js.map
@@ -1,5 +1,6 @@
1
1
  import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
2
- import type { RType } from '../type';
2
+ import { RType } from '../type';
3
+ import type { OperatorInformationValue } from '../operators';
3
4
  /**
4
5
  * Operators like `+`, `==`, `&&`, etc.
5
6
  */
@@ -9,3 +10,17 @@ export interface RBinaryOp<Info = NoInfo> extends RAstNodeBase<Info>, Location {
9
10
  lhs: RNode<Info>;
10
11
  rhs: RNode<Info>;
11
12
  }
13
+ /**
14
+ * Helper for working with {@link RBinaryOp} AST nodes.
15
+ */
16
+ export declare const RBinaryOp: {
17
+ readonly name: "RBinaryOp";
18
+ /**
19
+ * Type guard for {@link RBinaryOp} nodes.
20
+ */
21
+ readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RBinaryOp<Info>;
22
+ /**
23
+ * Get the operator information for a binary operator node.
24
+ */
25
+ readonly getOperatorInfo: <Info = object>(node: RBinaryOp<Info>) => OperatorInformationValue | undefined;
26
+ };
@@ -1,3 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RBinaryOp = void 0;
4
+ const type_1 = require("../type");
5
+ const operators_1 = require("../operators");
6
+ /**
7
+ * Helper for working with {@link RBinaryOp} AST nodes.
8
+ */
9
+ exports.RBinaryOp = {
10
+ name: 'RBinaryOp',
11
+ /**
12
+ * Type guard for {@link RBinaryOp} nodes.
13
+ */
14
+ is(node) {
15
+ return node?.type === type_1.RType.BinaryOp;
16
+ },
17
+ /**
18
+ * Get the operator information for a binary operator node.
19
+ */
20
+ getOperatorInfo(node) {
21
+ return operators_1.OperatorDatabase[node.operator];
22
+ }
23
+ };
3
24
  //# sourceMappingURL=r-binary-op.js.map
@@ -1,8 +1,18 @@
1
1
  import type { Leaf, Location, NoInfo } from '../model';
2
- import type { RType } from '../type';
2
+ import { RType } from '../type';
3
3
  /**
4
4
  * A `break` statement.
5
5
  */
6
6
  export interface RBreak<Info = NoInfo> extends Location, Leaf<Info> {
7
7
  readonly type: RType.Break;
8
8
  }
9
+ /**
10
+ * Helper for working with {@link RBreak} AST nodes.
11
+ */
12
+ export declare const RBreak: {
13
+ readonly name: "RBreak";
14
+ /**
15
+ * Type guard for {@link RBreak} nodes.
16
+ */
17
+ readonly is: <Info = object>(this: void, node: unknown) => node is RBreak<Info>;
18
+ };
@@ -1,3 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RBreak = void 0;
4
+ const type_1 = require("../type");
5
+ /**
6
+ * Helper for working with {@link RBreak} AST nodes.
7
+ */
8
+ exports.RBreak = {
9
+ name: 'RBreak',
10
+ /**
11
+ * Type guard for {@link RBreak} nodes.
12
+ */
13
+ is(node) {
14
+ return typeof node === 'object' && node !== null && node.type === type_1.RType.Break;
15
+ }
16
+ };
3
17
  //# sourceMappingURL=r-break.js.map
@@ -9,6 +9,12 @@ export interface RComment<Info = NoInfo> extends Location, Leaf<Info> {
9
9
  readonly type: RType.Comment;
10
10
  }
11
11
  /**
12
- * Checks whether the given node is an R comment.
12
+ * Helper for working with {@link RComment} AST nodes.
13
13
  */
14
- export declare function isRComment<Info = NoInfo>(node: unknown): node is RComment<Info>;
14
+ export declare const RComment: {
15
+ readonly name: "RComment";
16
+ /**
17
+ * Type guard for {@link RComment} nodes.
18
+ */
19
+ readonly is: <Info = object>(this: void, node: unknown) => node is RComment<Info>;
20
+ };
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isRComment = isRComment;
3
+ exports.RComment = void 0;
4
4
  const type_1 = require("../type");
5
5
  /**
6
- * Checks whether the given node is an R comment.
6
+ * Helper for working with {@link RComment} AST nodes.
7
7
  */
8
- function isRComment(node) {
9
- return typeof node === 'object' && node !== null && node.type === type_1.RType.Comment;
10
- }
8
+ exports.RComment = {
9
+ name: 'RComment',
10
+ /**
11
+ * Type guard for {@link RComment} nodes.
12
+ */
13
+ is(node) {
14
+ return typeof node === 'object' && node !== null && node.type === type_1.RType.Comment;
15
+ }
16
+ };
11
17
  //# sourceMappingURL=r-comment.js.map
@@ -1,5 +1,5 @@
1
1
  import type { RAstNodeBase, Location, NoInfo, RNode, WithChildren } from '../model';
2
- import type { RType } from '../type';
2
+ import { RType } from '../type';
3
3
  import type { RSymbol } from './r-symbol';
4
4
  /**
5
5
  * Holds a list of expressions (and hence may be the root of an AST, summarizing all expressions in a file).
@@ -10,3 +10,25 @@ export interface RExpressionList<Info = NoInfo> extends WithChildren<Info, RNode
10
10
  /** encodes wrappers like `{}` or `()` */
11
11
  readonly grouping: undefined | [start: RSymbol<Info>, end: RSymbol<Info>];
12
12
  }
13
+ /**
14
+ * Helper for working with {@link RExpressionList} AST nodes.
15
+ */
16
+ export declare const RExpressionList: {
17
+ readonly name: "RExpressionList";
18
+ /**
19
+ * Type guard for {@link RExpressionList} nodes.
20
+ */
21
+ readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RExpressionList<Info>;
22
+ /**
23
+ * Type guard for implicit {@link RExpressionList} nodes, i.e., expression lists that are not created by a wrapper like `{}`.
24
+ */
25
+ readonly isImplicit: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RExpressionList<Info>;
26
+ /**
27
+ * Returns the grouping symbol at the start of the expression list, if it exists. For example, for an expression list created by `{ ... }`, this would return the symbol for `{`.
28
+ */
29
+ readonly groupStart: <Info = object>(this: void, node: RExpressionList<Info>) => RSymbol<Info> | undefined;
30
+ /**
31
+ * Returns the grouping symbol at the end of the expression list, if it exists. For example, for an expression list created by `{ ... }`, this would return the symbol for `}`.
32
+ */
33
+ readonly groupEnd: <Info = object>(this: void, node: RExpressionList<Info>) => RSymbol<Info> | undefined;
34
+ };
@@ -1,3 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RExpressionList = void 0;
4
+ const type_1 = require("../type");
5
+ /**
6
+ * Helper for working with {@link RExpressionList} AST nodes.
7
+ */
8
+ exports.RExpressionList = {
9
+ name: 'RExpressionList',
10
+ /**
11
+ * Type guard for {@link RExpressionList} nodes.
12
+ */
13
+ is(node) {
14
+ return node?.type === type_1.RType.ExpressionList;
15
+ },
16
+ /**
17
+ * Type guard for implicit {@link RExpressionList} nodes, i.e., expression lists that are not created by a wrapper like `{}`.
18
+ */
19
+ isImplicit(node) {
20
+ return exports.RExpressionList.is(node) && node.grouping === undefined;
21
+ },
22
+ /**
23
+ * Returns the grouping symbol at the start of the expression list, if it exists. For example, for an expression list created by `{ ... }`, this would return the symbol for `{`.
24
+ */
25
+ groupStart(node) {
26
+ return node.grouping?.[0];
27
+ },
28
+ /**
29
+ * Returns the grouping symbol at the end of the expression list, if it exists. For example, for an expression list created by `{ ... }`, this would return the symbol for `}`.
30
+ */
31
+ groupEnd(node) {
32
+ return node.grouping?.[1];
33
+ }
34
+ };
3
35
  //# sourceMappingURL=r-expression-list.js.map
@@ -1,5 +1,5 @@
1
1
  import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
2
- import type { RType } from '../type';
2
+ import { RType } from '../type';
3
3
  import type { RSymbol } from './r-symbol';
4
4
  import type { RExpressionList } from './r-expression-list';
5
5
  /**
@@ -16,3 +16,13 @@ export interface RForLoop<Info = NoInfo> extends RAstNodeBase<Info>, Location {
16
16
  /** body used in for-loop: <p> `for(... in ...) <body>`*/
17
17
  body: RExpressionList<Info>;
18
18
  }
19
+ /**
20
+ * Helper for working with {@link RForLoop} AST nodes.
21
+ */
22
+ export declare const RForLoop: {
23
+ readonly name: "RForLoop";
24
+ /**
25
+ * Type guard for RForLoop nodes.
26
+ */
27
+ readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RForLoop<Info>;
28
+ };
@@ -1,3 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RForLoop = void 0;
4
+ const type_1 = require("../type");
5
+ /**
6
+ * Helper for working with {@link RForLoop} AST nodes.
7
+ */
8
+ exports.RForLoop = {
9
+ name: 'RForLoop',
10
+ /**
11
+ * Type guard for RForLoop nodes.
12
+ */
13
+ is(node) {
14
+ return node?.type === type_1.RType.ForLoop;
15
+ }
16
+ };
3
17
  //# sourceMappingURL=r-for-loop.js.map
@@ -1,5 +1,5 @@
1
1
  import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
2
- import type { RType } from '../type';
2
+ import { RType } from '../type';
3
3
  import type { RSymbol } from './r-symbol';
4
4
  import type { RArgument } from './r-argument';
5
5
  export declare const EmptyArgument = "<>";
@@ -29,3 +29,21 @@ export interface RUnnamedFunctionCall<Info = NoInfo> extends RAstNodeBase<Info>,
29
29
  readonly arguments: readonly RFunctionArgument<Info>[];
30
30
  }
31
31
  export type RFunctionCall<Info = NoInfo> = RNamedFunctionCall<Info> | RUnnamedFunctionCall<Info>;
32
+ /**
33
+ * Helper for working with {@link RFunctionCall} AST nodes.
34
+ */
35
+ export declare const RFunctionCall: {
36
+ readonly name: "RFunctionCall";
37
+ /**
38
+ * Type guard for {@link RFunctionCall} nodes.
39
+ */
40
+ readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RFunctionCall<Info>;
41
+ /**
42
+ * Type guard for {@link RNamedFunctionCall} nodes.
43
+ */
44
+ readonly isNamed: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RNamedFunctionCall<Info>;
45
+ /**
46
+ * Type guard for {@link RUnnamedFunctionCall} nodes.
47
+ */
48
+ readonly isUnnamed: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RUnnamedFunctionCall<Info>;
49
+ };
@@ -1,5 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EmptyArgument = void 0;
3
+ exports.RFunctionCall = exports.EmptyArgument = void 0;
4
+ const type_1 = require("../type");
4
5
  exports.EmptyArgument = '<>';
6
+ /**
7
+ * Helper for working with {@link RFunctionCall} AST nodes.
8
+ */
9
+ exports.RFunctionCall = {
10
+ name: 'RFunctionCall',
11
+ /**
12
+ * Type guard for {@link RFunctionCall} nodes.
13
+ */
14
+ is(node) {
15
+ return node?.type === type_1.RType.FunctionCall;
16
+ },
17
+ /**
18
+ * Type guard for {@link RNamedFunctionCall} nodes.
19
+ */
20
+ isNamed(node) {
21
+ return exports.RFunctionCall.is(node) && node.named === true;
22
+ },
23
+ /**
24
+ * Type guard for {@link RUnnamedFunctionCall} nodes.
25
+ */
26
+ isUnnamed(node) {
27
+ return exports.RFunctionCall.is(node) && !node.named;
28
+ }
29
+ };
5
30
  //# sourceMappingURL=r-function-call.js.map
@@ -1,5 +1,5 @@
1
1
  import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
2
- import type { RType } from '../type';
2
+ import { RType } from '../type';
3
3
  import type { RParameter } from './r-parameter';
4
4
  /**
5
5
  * ```r
@@ -16,3 +16,13 @@ export interface RFunctionDefinition<Info = NoInfo> extends RAstNodeBase<Info>,
16
16
  parameters: RParameter<Info>[];
17
17
  body: RNode<Info>;
18
18
  }
19
+ /**
20
+ * Helper for working with {@link RFunctionDefinition} AST nodes.
21
+ */
22
+ export declare const RFunctionDefinition: {
23
+ readonly name: "RFunctionDefinition";
24
+ /**
25
+ * Type guard for {@link RFunctionDefinition} nodes.
26
+ */
27
+ readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RFunctionDefinition<Info>;
28
+ };
@@ -1,3 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RFunctionDefinition = void 0;
4
+ const type_1 = require("../type");
5
+ /**
6
+ * Helper for working with {@link RFunctionDefinition} AST nodes.
7
+ */
8
+ exports.RFunctionDefinition = {
9
+ name: 'RFunctionDefinition',
10
+ /**
11
+ * Type guard for {@link RFunctionDefinition} nodes.
12
+ */
13
+ is(node) {
14
+ return node?.type === type_1.RType.FunctionDefinition;
15
+ }
16
+ };
3
17
  //# sourceMappingURL=r-function-definition.js.map
@@ -1,5 +1,5 @@
1
1
  import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
2
- import type { RType } from '../type';
2
+ import { RType } from '../type';
3
3
  import type { RExpressionList } from './r-expression-list';
4
4
  /**
5
5
  * ```r
@@ -12,3 +12,13 @@ export interface RIfThenElse<Info = NoInfo> extends RAstNodeBase<Info>, Location
12
12
  then: RExpressionList<Info>;
13
13
  otherwise?: RExpressionList<Info>;
14
14
  }
15
+ /**
16
+ * Helper for working with {@link RIfThenElse} AST nodes.
17
+ */
18
+ export declare const RIfThenElse: {
19
+ readonly name: "RIfThenElse";
20
+ /**
21
+ * Type guard for {@link RIfThenElse} nodes.
22
+ */
23
+ readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RIfThenElse<Info>;
24
+ };
@@ -1,3 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RIfThenElse = void 0;
4
+ const type_1 = require("../type");
5
+ /**
6
+ * Helper for working with {@link RIfThenElse} AST nodes.
7
+ */
8
+ exports.RIfThenElse = {
9
+ name: 'RIfThenElse',
10
+ /**
11
+ * Type guard for {@link RIfThenElse} nodes.
12
+ */
13
+ is(node) {
14
+ return node?.type === type_1.RType.IfThenElse;
15
+ }
16
+ };
3
17
  //# sourceMappingURL=r-if-then-else.js.map
@@ -1,5 +1,5 @@
1
- import type { Leaf, Location, NoInfo } from '../model';
2
- import type { RType } from '../type';
1
+ import type { Leaf, Location, NoInfo, RNode } from '../model';
2
+ import { RType } from '../type';
3
3
  /**
4
4
  * Special comment to signal line mappings (e.g., in generated code) to the interpreter.
5
5
  */
@@ -8,3 +8,13 @@ export interface RLineDirective<Info = NoInfo> extends Location, Leaf<Info> {
8
8
  line: number;
9
9
  file: string;
10
10
  }
11
+ /**
12
+ * Helper for working with {@link RLineDirective} AST nodes.
13
+ */
14
+ export declare const RLineDirective: {
15
+ readonly name: "RLineDirective";
16
+ /**
17
+ * Type guard for {@link RLineDirective} nodes.
18
+ */
19
+ readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RLineDirective<Info>;
20
+ };
@@ -1,3 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RLineDirective = void 0;
4
+ const type_1 = require("../type");
5
+ /**
6
+ * Helper for working with {@link RLineDirective} AST nodes.
7
+ */
8
+ exports.RLineDirective = {
9
+ name: 'RLineDirective',
10
+ /**
11
+ * Type guard for {@link RLineDirective} nodes.
12
+ */
13
+ is(node) {
14
+ return node?.type === type_1.RType.LineDirective;
15
+ }
16
+ };
3
17
  //# sourceMappingURL=r-line-directive.js.map
@@ -1,5 +1,5 @@
1
- import type { Leaf, Location, NoInfo } from '../model';
2
- import type { RType } from '../type';
1
+ import type { Leaf, Location, NoInfo, RNode } from '../model';
2
+ import { RType } from '../type';
3
3
  export type RLogicalValue = boolean;
4
4
  /**
5
5
  * Represents logical values (`TRUE` or `FALSE`).
@@ -8,3 +8,21 @@ export interface RLogical<Info = NoInfo> extends Leaf<Info>, Location {
8
8
  readonly type: RType.Logical;
9
9
  content: RLogicalValue;
10
10
  }
11
+ /**
12
+ * Helper for working with {@link RLogical} AST nodes.
13
+ */
14
+ export declare const RLogical: {
15
+ readonly name: "RLogical";
16
+ /**
17
+ * Type guard for {@link RLogical} nodes.
18
+ */
19
+ readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RLogical<Info>;
20
+ /**
21
+ * Checks whether a node is a logical constant with value `TRUE`.
22
+ */
23
+ readonly isTrue: <Info = object>(this: void, node: RNode<Info> | undefined) => boolean;
24
+ /**
25
+ * Checks whether a node is a logical constant with value `FALSE`.
26
+ */
27
+ readonly isFalse: <Info = object>(this: void, node: RNode<Info> | undefined) => boolean;
28
+ };
@@ -1,3 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RLogical = void 0;
4
+ const type_1 = require("../type");
5
+ /**
6
+ * Helper for working with {@link RLogical} AST nodes.
7
+ */
8
+ exports.RLogical = {
9
+ name: 'RLogical',
10
+ /**
11
+ * Type guard for {@link RLogical} nodes.
12
+ */
13
+ is(node) {
14
+ return node?.type === type_1.RType.Logical;
15
+ },
16
+ /**
17
+ * Checks whether a node is a logical constant with value `TRUE`.
18
+ */
19
+ isTrue(node) {
20
+ return exports.RLogical.is(node) && node.content;
21
+ },
22
+ /**
23
+ * Checks whether a node is a logical constant with value `FALSE`.
24
+ */
25
+ isFalse(node) {
26
+ return exports.RLogical.is(node) && !node.content;
27
+ }
28
+ };
3
29
  //# sourceMappingURL=r-logical.js.map
@@ -1,8 +1,18 @@
1
- import type { Leaf, Location, NoInfo } from '../model';
2
- import type { RType } from '../type';
1
+ import type { Leaf, Location, NoInfo, RNode } from '../model';
2
+ import { RType } from '../type';
3
3
  /**
4
4
  * A `next` statement.
5
5
  */
6
6
  export interface RNext<Info = NoInfo> extends Location, Leaf<Info> {
7
7
  readonly type: RType.Next;
8
8
  }
9
+ /**
10
+ * Helper for working with {@link RNext} AST nodes.
11
+ */
12
+ export declare const RNext: {
13
+ readonly name: "RNext";
14
+ /**
15
+ * Type guard for {@link RNext} nodes.
16
+ */
17
+ readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RNext<Info>;
18
+ };
@@ -1,3 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RNext = void 0;
4
+ const type_1 = require("../type");
5
+ /**
6
+ * Helper for working with {@link RNext} AST nodes.
7
+ */
8
+ exports.RNext = {
9
+ name: 'RNext',
10
+ /**
11
+ * Type guard for {@link RNext} nodes.
12
+ */
13
+ is(node) {
14
+ return node?.type === type_1.RType.Next;
15
+ }
16
+ };
3
17
  //# sourceMappingURL=r-next.js.map
@@ -11,6 +11,12 @@ export interface RNumber<Info = NoInfo> extends Leaf<Info>, Location {
11
11
  content: RNumberValue;
12
12
  }
13
13
  /**
14
- * Checks whether the given node is an RNumber.
14
+ * Helper for working with {@link RNumber} AST nodes.
15
15
  */
16
- export declare function isRNumber(node: RNode | undefined): node is RNumber;
16
+ export declare const RNumber: {
17
+ readonly name: "RNumber";
18
+ /**
19
+ * Type guard for {@link RNumber} nodes.
20
+ */
21
+ readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RNumber<Info>;
22
+ };
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isRNumber = isRNumber;
3
+ exports.RNumber = void 0;
4
4
  const type_1 = require("../type");
5
5
  /**
6
- * Checks whether the given node is an RNumber.
6
+ * Helper for working with {@link RNumber} AST nodes.
7
7
  */
8
- function isRNumber(node) {
9
- return node?.type === type_1.RType.Number;
10
- }
8
+ exports.RNumber = {
9
+ name: 'RNumber',
10
+ /**
11
+ * Type guard for {@link RNumber} nodes.
12
+ */
13
+ is(node) {
14
+ return node?.type === type_1.RType.Number;
15
+ }
16
+ };
11
17
  //# sourceMappingURL=r-number.js.map
@@ -1,5 +1,5 @@
1
1
  import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
2
- import type { RType } from '../type';
2
+ import { RType } from '../type';
3
3
  import type { RSymbol } from './r-symbol';
4
4
  import type { BrandedIdentifier } from '../../../../../dataflow/environments/identifier';
5
5
  /**
@@ -12,3 +12,19 @@ export interface RParameter<Info = NoInfo> extends RAstNodeBase<Info>, Location
12
12
  special: boolean;
13
13
  defaultValue: RNode<Info> | undefined;
14
14
  }
15
+ /**
16
+ * Helper for working with {@link RParameter} AST nodes.
17
+ */
18
+ export declare const RParameter: {
19
+ readonly name: "RParameter";
20
+ /**
21
+ * Type guard for {@link RParameter} nodes.
22
+ * @see {@link RParameter.isDotDotDotDot} - to check whether a parameter is the special `...` parameter
23
+ */
24
+ readonly is: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RParameter<Info>;
25
+ /**
26
+ * Type guard for the special `...` parameter.
27
+ * @see {@link RParameter.is} - to check whether a node is a parameter at all
28
+ */
29
+ readonly isDotDotDotDot: <Info = object>(this: void, node: RNode<Info> | undefined) => node is RParameter<Info>;
30
+ };