@eagleoutice/flowr 2.7.6 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/README.md +67 -64
  2. package/cli/wiki.js +1 -1
  3. package/control-flow/extract-cfg.js +3 -3
  4. package/control-flow/useless-loop.d.ts +1 -1
  5. package/control-flow/useless-loop.js +2 -2
  6. package/dataflow/cluster.js +3 -3
  7. package/dataflow/environments/built-in-config.d.ts +8 -4
  8. package/dataflow/environments/built-in.d.ts +27 -14
  9. package/dataflow/environments/built-in.js +27 -12
  10. package/dataflow/environments/default-builtin-config.d.ts +615 -3
  11. package/dataflow/environments/default-builtin-config.js +50 -15
  12. package/dataflow/environments/environment.js +3 -2
  13. package/dataflow/environments/identifier.d.ts +5 -1
  14. package/dataflow/environments/reference-to-maybe.d.ts +2 -2
  15. package/dataflow/environments/reference-to-maybe.js +23 -14
  16. package/dataflow/environments/resolve-by-name.d.ts +6 -2
  17. package/dataflow/environments/resolve-by-name.js +5 -1
  18. package/dataflow/environments/scoping.js +1 -3
  19. package/dataflow/eval/resolve/alias-tracking.js +5 -1
  20. package/dataflow/extractor.js +3 -3
  21. package/dataflow/fn/exceptions-of-function.d.ts +13 -0
  22. package/dataflow/fn/exceptions-of-function.js +47 -0
  23. package/dataflow/fn/higher-order-function.d.ts +1 -1
  24. package/dataflow/fn/higher-order-function.js +3 -3
  25. package/dataflow/fn/recursive-function.d.ts +6 -0
  26. package/dataflow/fn/recursive-function.js +32 -0
  27. package/dataflow/graph/call-graph.d.ts +10 -0
  28. package/dataflow/graph/call-graph.js +212 -0
  29. package/dataflow/graph/dataflowgraph-builder.d.ts +7 -2
  30. package/dataflow/graph/dataflowgraph-builder.js +14 -9
  31. package/dataflow/graph/diff-dataflow-graph.js +96 -2
  32. package/dataflow/graph/graph.d.ts +10 -7
  33. package/dataflow/graph/graph.js +7 -8
  34. package/dataflow/graph/vertex.d.ts +6 -3
  35. package/dataflow/hooks.d.ts +30 -0
  36. package/dataflow/hooks.js +38 -0
  37. package/dataflow/info.d.ts +28 -5
  38. package/dataflow/info.js +66 -31
  39. package/dataflow/internal/linker.d.ts +13 -3
  40. package/dataflow/internal/linker.js +163 -73
  41. package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +4 -0
  42. package/dataflow/internal/process/functions/call/argument/unpack-argument.js +7 -0
  43. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
  44. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +19 -3
  45. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +14 -0
  46. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +30 -0
  47. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +2 -1
  48. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +24 -17
  49. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -1
  50. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +5 -1
  51. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +59 -21
  52. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -3
  53. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.d.ts +34 -0
  54. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +92 -0
  55. package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -0
  56. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.d.ts +21 -0
  57. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +129 -0
  58. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +16 -0
  59. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +127 -0
  60. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +5 -3
  61. package/dataflow/internal/process/functions/call/common.d.ts +13 -1
  62. package/dataflow/internal/process/functions/call/common.js +33 -2
  63. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +13 -1
  64. package/dataflow/internal/process/functions/call/known-call-handling.js +29 -3
  65. package/dataflow/internal/process/functions/call/named-call-handling.js +2 -1
  66. package/dataflow/internal/process/functions/call/unnamed-call-handling.js +6 -4
  67. package/dataflow/internal/process/functions/process-argument.js +7 -6
  68. package/dataflow/internal/process/functions/process-parameter.js +2 -1
  69. package/dataflow/internal/process/process-named-call.d.ts +2 -2
  70. package/dataflow/internal/process/process-symbol.js +3 -2
  71. package/dataflow/internal/process/process-value.d.ts +3 -2
  72. package/dataflow/internal/process/process-value.js +8 -6
  73. package/dataflow/origin/dfg-get-origin.js +2 -1
  74. package/dataflow/origin/dfg-get-symbol-refs.js +1 -1
  75. package/documentation/doc-readme.d.ts +1 -1
  76. package/documentation/doc-readme.js +6 -6
  77. package/documentation/doc-util/doc-code.js +1 -1
  78. package/documentation/doc-util/doc-dfg.d.ts +1 -0
  79. package/documentation/doc-util/doc-dfg.js +7 -4
  80. package/documentation/doc-util/doc-query.d.ts +1 -0
  81. package/documentation/doc-util/doc-query.js +1 -1
  82. package/documentation/doc-util/doc-repl.d.ts +2 -1
  83. package/documentation/doc-util/doc-repl.js +11 -3
  84. package/documentation/wiki-analyzer.js +2 -0
  85. package/documentation/wiki-dataflow-graph.js +59 -16
  86. package/documentation/wiki-interface.js +33 -5
  87. package/documentation/wiki-mk/doc-context.d.ts +2 -1
  88. package/documentation/wiki-mk/doc-context.js +2 -2
  89. package/documentation/wiki-mk/doc-maker.js +4 -3
  90. package/documentation/wiki-normalized-ast.js +6 -0
  91. package/documentation/wiki-query.js +109 -1
  92. package/linter/linter-rules.d.ts +1 -1
  93. package/linter/rules/seeded-randomness.js +17 -12
  94. package/linter/rules/useless-loop.d.ts +1 -1
  95. package/package.json +9 -9
  96. package/project/cache/flowr-analyzer-cache.d.ts +11 -0
  97. package/project/cache/flowr-analyzer-cache.js +19 -0
  98. package/project/context/flowr-analyzer-dependencies-context.d.ts +6 -1
  99. package/project/context/flowr-analyzer-dependencies-context.js +6 -0
  100. package/project/context/flowr-analyzer-files-context.d.ts +5 -2
  101. package/project/context/flowr-analyzer-files-context.js +24 -17
  102. package/project/context/flowr-file.d.ts +9 -4
  103. package/project/context/flowr-file.js +20 -6
  104. package/project/flowr-analyzer.d.ts +11 -0
  105. package/project/flowr-analyzer.js +6 -0
  106. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +8 -0
  107. package/project/plugins/file-plugins/files/flowr-description-file.js +36 -3
  108. package/project/plugins/file-plugins/files/flowr-jupyter-file.js +1 -1
  109. package/project/plugins/file-plugins/files/flowr-namespace-file.js +1 -1
  110. package/project/plugins/file-plugins/files/flowr-news-file.js +1 -1
  111. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +1 -1
  112. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +1 -1
  113. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.d.ts +4 -1
  114. package/project/plugins/file-plugins/flowr-analyzer-file-plugin.js +3 -0
  115. package/project/plugins/file-plugins/{flowr-analyzer-namespace-file-plugin.d.ts → flowr-analyzer-namespace-files-plugin.d.ts} +1 -1
  116. package/project/plugins/file-plugins/{flowr-analyzer-namespace-file-plugin.js → flowr-analyzer-namespace-files-plugin.js} +4 -4
  117. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.d.ts +26 -0
  118. package/project/plugins/file-plugins/flowr-analyzer-test-file-plugin.js +39 -0
  119. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.d.ts +26 -0
  120. package/project/plugins/file-plugins/flowr-analyzer-vignette-file-plugin.js +39 -0
  121. package/project/plugins/flowr-analyzer-plugin-defaults.js +6 -2
  122. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +3 -13
  123. package/project/plugins/package-version-plugins/package.d.ts +1 -1
  124. package/project/plugins/package-version-plugins/package.js +3 -3
  125. package/project/plugins/plugin-registry.d.ts +4 -2
  126. package/project/plugins/plugin-registry.js +6 -2
  127. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.d.ts +11 -0
  128. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +5 -2
  129. package/queries/catalog/call-context-query/call-context-query-format.d.ts +4 -12
  130. package/queries/catalog/call-graph-query/call-graph-query-executor.d.ts +6 -0
  131. package/queries/catalog/call-graph-query/call-graph-query-executor.js +21 -0
  132. package/queries/catalog/call-graph-query/call-graph-query-format.d.ts +21 -0
  133. package/queries/catalog/call-graph-query/call-graph-query-format.js +32 -0
  134. package/queries/catalog/dataflow-query/dataflow-query-executor.js +4 -3
  135. package/queries/catalog/dependencies-query/dependencies-query-executor.js +29 -3
  136. package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +1 -0
  137. package/queries/catalog/dependencies-query/function-info/function-info.d.ts +8 -1
  138. package/queries/catalog/dependencies-query/function-info/write-functions.js +13 -0
  139. package/queries/catalog/does-call-query/does-call-query-executor.d.ts +6 -0
  140. package/queries/catalog/does-call-query/does-call-query-executor.js +100 -0
  141. package/queries/catalog/does-call-query/does-call-query-format.d.ts +51 -0
  142. package/queries/catalog/does-call-query/does-call-query-format.js +102 -0
  143. package/queries/catalog/files-query/files-query-executor.js +4 -4
  144. package/queries/catalog/files-query/files-query-format.d.ts +2 -1
  145. package/queries/catalog/files-query/files-query-format.js +18 -2
  146. package/queries/catalog/id-map-query/id-map-query-executor.js +4 -3
  147. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +18 -0
  148. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +56 -0
  149. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +34 -0
  150. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +54 -0
  151. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +3 -3
  152. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +6 -0
  153. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +12 -0
  154. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.d.ts +6 -0
  155. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +23 -0
  156. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +28 -0
  157. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +44 -0
  158. package/queries/catalog/linter-query/linter-query-format.js +4 -1
  159. package/queries/catalog/location-map-query/location-map-query-executor.js +1 -1
  160. package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +4 -3
  161. package/queries/catalog/project-query/project-query-executor.js +9 -3
  162. package/queries/catalog/project-query/project-query-format.d.ts +6 -1
  163. package/queries/catalog/project-query/project-query-format.js +35 -9
  164. package/queries/query.d.ts +34 -2
  165. package/queries/query.js +9 -0
  166. package/r-bridge/data/data.d.ts +10 -5
  167. package/r-bridge/data/data.js +11 -5
  168. package/r-bridge/lang-4.x/ast/model/model.d.ts +7 -7
  169. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +2 -2
  170. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +2 -2
  171. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +2 -2
  172. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +5 -2
  173. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +8 -0
  174. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -2
  175. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +2 -2
  176. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +3 -3
  177. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +2 -2
  178. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +2 -2
  179. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +2 -2
  180. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -2
  181. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +2 -2
  182. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +2 -2
  183. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -2
  184. package/r-bridge/lang-4.x/ast/parser/main/internal/other/normalize-comment.js +0 -1
  185. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +0 -2
  186. package/r-bridge/roxygen2/roxygen-ast.d.ts +218 -0
  187. package/r-bridge/roxygen2/roxygen-ast.js +82 -0
  188. package/r-bridge/roxygen2/roxygen-parse.d.ts +24 -0
  189. package/r-bridge/roxygen2/roxygen-parse.js +214 -0
  190. package/reconstruct/auto-select/magic-comments.js +4 -4
  191. package/slicing/static/slice-call.js +3 -4
  192. package/slicing/static/static-slicer.js +2 -2
  193. package/statistics/features/supported/defined-functions/defined-functions.js +1 -1
  194. package/util/collections/defaultmap.d.ts +3 -3
  195. package/util/mermaid/dfg.js +5 -5
  196. package/util/objects.js +1 -1
  197. package/util/r-author.d.ts +5 -0
  198. package/util/r-author.js +110 -0
  199. package/util/r-license.d.ts +10 -1
  200. package/util/r-license.js +27 -6
  201. package/util/r-version.d.ts +19 -0
  202. package/util/r-version.js +106 -0
  203. package/util/range.d.ts +6 -0
  204. package/util/range.js +7 -0
  205. package/util/simple-df/dfg-ascii.js +2 -2
  206. package/util/text/args.d.ts +9 -0
  207. package/util/text/args.js +65 -0
  208. package/util/version.js +1 -1
@@ -23,7 +23,7 @@ import type { RUnaryOp } from './nodes/r-unary-op';
23
23
  import type { RBinaryOp } from './nodes/r-binary-op';
24
24
  import type { RPipe } from './nodes/r-pipe';
25
25
  import type { RDelimiter } from './nodes/info/r-delimiter';
26
- /** Simply an empty type constraint used to say that there are additional decorations (see {@link Base}). */
26
+ /** Simply an empty type constraint used to say that there are additional decorations (see {@link RAstNodeBase}). */
27
27
  export type NoInfo = object;
28
28
  /**
29
29
  * Will be used to reconstruct the source of the given element in the R-ast.
@@ -57,27 +57,27 @@ interface Source {
57
57
  * @typeParam Info - can be used to store additional information about the node
58
58
  * @typeParam LexemeType - the type of the lexeme, probably always a `string` or `string | undefined`
59
59
  */
60
- export interface Base<Info, LexemeType = string> extends MergeableRecord {
60
+ export interface RAstNodeBase<Info, LexemeType = string> extends MergeableRecord {
61
61
  type: RType;
62
62
  /** the original string retrieved from R, can be used for further identification */
63
63
  lexeme: LexemeType;
64
64
  /** allows to attach additional information to the node */
65
65
  info: Info & Source;
66
66
  }
67
- export interface WithChildren<Info, Children extends Base<Info, string | undefined>> {
67
+ export interface WithChildren<Info, Children extends RAstNodeBase<Info, string | undefined>> {
68
68
  children: readonly Children[];
69
69
  }
70
70
  /**
71
71
  * A helper interface we use to "mark" leaf nodes.
72
72
  * <p>
73
73
  * Please be aware, that this is not marking from a language perspective,
74
- * as it is equivalent to the {@link Base} interface.
74
+ * as it is equivalent to the {@link RAstNodeBase} interface.
75
75
  * It is intended to help humans understand the code.
76
76
  */
77
- export interface Leaf<Info = NoInfo, LexemeType = string> extends Base<Info, LexemeType> {
77
+ export interface Leaf<Info = NoInfo, LexemeType = string> extends RAstNodeBase<Info, LexemeType> {
78
78
  }
79
79
  /**
80
- * Indicates, that the respective {@link Base} node has known source code
80
+ * Indicates, that the respective {@link RAstNodeBase} node has known source code
81
81
  * location information.
82
82
  */
83
83
  export interface Location {
@@ -95,7 +95,7 @@ export interface Location {
95
95
  export type NamespaceIdentifier = string;
96
96
  /**
97
97
  * Similar to {@link Location} this is an interface that indicates that
98
- * the respective {@link Base} node has a respective property (a namespace).
98
+ * the respective {@link RAstNodeBase} node has a respective property (a namespace).
99
99
  */
100
100
  export interface Namespace {
101
101
  /**
@@ -1,11 +1,11 @@
1
- import type { Base, Location, NoInfo, RNode } from '../model';
1
+ import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
2
2
  import type { RType } from '../type';
3
3
  import type { RArgument, RUnnamedArgument } from './r-argument';
4
4
  import type { EmptyArgument } from './r-function-call';
5
5
  /**
6
6
  * Represents an R Indexing operation with `$`, `@`, `[[`, or `[`.
7
7
  */
8
- interface RAccessBase<Info = NoInfo> extends Base<Info>, Location {
8
+ interface RAccessBase<Info = NoInfo> extends RAstNodeBase<Info>, Location {
9
9
  readonly type: RType.Access;
10
10
  /** the accessed container/variable/expression */
11
11
  accessed: RNode<Info>;
@@ -1,10 +1,10 @@
1
- import type { Base, Location, NoInfo, RNode } from '../model';
1
+ import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
2
2
  import type { RType } from '../type';
3
3
  import type { RSymbol } from './r-symbol';
4
4
  /**
5
5
  * Represents a named or unnamed argument of a function definition in R.
6
6
  */
7
- export interface RArgument<Info = NoInfo> extends Base<Info>, Location {
7
+ export interface RArgument<Info = NoInfo> extends RAstNodeBase<Info>, Location {
8
8
  readonly type: RType.Argument;
9
9
  name: RSymbol<Info> | undefined;
10
10
  value: RNode<Info> | undefined;
@@ -1,9 +1,9 @@
1
- import type { Base, Location, NoInfo, RNode } from '../model';
1
+ import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
2
2
  import type { RType } from '../type';
3
3
  /**
4
4
  * Operators like `+`, `==`, `&&`, etc.
5
5
  */
6
- export interface RBinaryOp<Info = NoInfo> extends Base<Info>, Location {
6
+ export interface RBinaryOp<Info = NoInfo> extends RAstNodeBase<Info>, Location {
7
7
  readonly type: RType.BinaryOp;
8
8
  operator: string;
9
9
  lhs: RNode<Info>;
@@ -1,5 +1,5 @@
1
1
  import type { Leaf, Location, NoInfo } from '../model';
2
- import type { RType } from '../type';
2
+ import { RType } from '../type';
3
3
  /**
4
4
  * ```r
5
5
  * # I am a line comment
@@ -7,5 +7,8 @@ import type { RType } from '../type';
7
7
  */
8
8
  export interface RComment<Info = NoInfo> extends Location, Leaf<Info> {
9
9
  readonly type: RType.Comment;
10
- content: string;
11
10
  }
11
+ /**
12
+ * Checks whether the given node is an R comment.
13
+ */
14
+ export declare function isRComment<Info = NoInfo>(node: unknown): node is RComment<Info>;
@@ -1,3 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isRComment = isRComment;
4
+ const type_1 = require("../type");
5
+ /**
6
+ * Checks whether the given node is an R comment.
7
+ */
8
+ function isRComment(node) {
9
+ return typeof node === 'object' && node !== null && node.type === type_1.RType.Comment;
10
+ }
3
11
  //# sourceMappingURL=r-comment.js.map
@@ -1,11 +1,11 @@
1
- import type { Base, Location, NoInfo, RNode, WithChildren } from '../model';
1
+ import type { RAstNodeBase, Location, NoInfo, RNode, WithChildren } from '../model';
2
2
  import type { 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).
6
6
  * The `grouping` property holds information on if the expression list is structural or created by a wrapper like `{}` or `()`.
7
7
  */
8
- export interface RExpressionList<Info = NoInfo> extends WithChildren<Info, RNode<Info>>, Base<Info, string | undefined>, Partial<Location> {
8
+ export interface RExpressionList<Info = NoInfo> extends WithChildren<Info, RNode<Info>>, RAstNodeBase<Info, string | undefined>, Partial<Location> {
9
9
  readonly type: RType.ExpressionList;
10
10
  /** encodes wrappers like `{}` or `()` */
11
11
  readonly grouping: undefined | [start: RSymbol<Info>, end: RSymbol<Info>];
@@ -1,4 +1,4 @@
1
- import type { Base, Location, NoInfo, RNode } from '../model';
1
+ import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
2
2
  import type { RType } from '../type';
3
3
  import type { RSymbol } from './r-symbol';
4
4
  import type { RExpressionList } from './r-expression-list';
@@ -7,7 +7,7 @@ import type { RExpressionList } from './r-expression-list';
7
7
  * for(<variable> in <vector>) <body>
8
8
  * ```
9
9
  */
10
- export interface RForLoop<Info = NoInfo> extends Base<Info>, Location {
10
+ export interface RForLoop<Info = NoInfo> extends RAstNodeBase<Info>, Location {
11
11
  readonly type: RType.ForLoop;
12
12
  /** variable used in for-loop: <p> `for(<variable> in ...) ...`*/
13
13
  variable: RSymbol<Info>;
@@ -1,4 +1,4 @@
1
- import type { Base, Location, NoInfo, RNode } from '../model';
1
+ import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
2
2
  import type { RType } from '../type';
3
3
  import type { RSymbol } from './r-symbol';
4
4
  import type { RArgument } from './r-argument';
@@ -8,7 +8,7 @@ export type RFunctionArgument<Info = NoInfo> = RArgument<Info> | typeof EmptyArg
8
8
  * Calls of functions like `a()` and `foo(42, "hello")`.
9
9
  * @see RUnnamedFunctionCall
10
10
  */
11
- export interface RNamedFunctionCall<Info = NoInfo> extends Base<Info>, Location {
11
+ export interface RNamedFunctionCall<Info = NoInfo> extends RAstNodeBase<Info>, Location {
12
12
  readonly type: RType.FunctionCall;
13
13
  readonly named: true;
14
14
  functionName: RSymbol<Info>;
@@ -19,7 +19,7 @@ export interface RNamedFunctionCall<Info = NoInfo> extends Base<Info>, Location
19
19
  * Direct calls of functions like `(function(x) { x })(3)`.
20
20
  * @see RNamedFunctionCall
21
21
  */
22
- export interface RUnnamedFunctionCall<Info = NoInfo> extends Base<Info>, Location {
22
+ export interface RUnnamedFunctionCall<Info = NoInfo> extends RAstNodeBase<Info>, Location {
23
23
  readonly type: RType.FunctionCall;
24
24
  readonly named: false | undefined;
25
25
  calledFunction: RNode<Info>;
@@ -1,4 +1,4 @@
1
- import type { Base, Location, NoInfo, RNode } from '../model';
1
+ import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
2
2
  import type { RType } from '../type';
3
3
  import type { RParameter } from './r-parameter';
4
4
  /**
@@ -10,7 +10,7 @@ import type { RParameter } from './r-parameter';
10
10
  * \(<parameters>) <body>
11
11
  * ```
12
12
  */
13
- export interface RFunctionDefinition<Info = NoInfo> extends Base<Info>, Location {
13
+ export interface RFunctionDefinition<Info = NoInfo> extends RAstNodeBase<Info>, Location {
14
14
  readonly type: RType.FunctionDefinition;
15
15
  /** the R formals, to our knowledge, they must be unique */
16
16
  parameters: RParameter<Info>[];
@@ -1,4 +1,4 @@
1
- import type { Base, Location, NoInfo, RNode } from '../model';
1
+ import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
2
2
  import type { RType } from '../type';
3
3
  import type { RExpressionList } from './r-expression-list';
4
4
  /**
@@ -6,7 +6,7 @@ import type { RExpressionList } from './r-expression-list';
6
6
  * if(<condition>) <then> [else <otherwise>]
7
7
  * ```
8
8
  */
9
- export interface RIfThenElse<Info = NoInfo> extends Base<Info>, Location {
9
+ export interface RIfThenElse<Info = NoInfo> extends RAstNodeBase<Info>, Location {
10
10
  readonly type: RType.IfThenElse;
11
11
  condition: RNode<Info>;
12
12
  then: RExpressionList<Info>;
@@ -1,10 +1,10 @@
1
- import type { Base, Location, NoInfo, RNode } from '../model';
1
+ import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
2
2
  import type { RType } from '../type';
3
3
  import type { RSymbol } from './r-symbol';
4
4
  /**
5
5
  * Represents a parameter of a function definition in R.
6
6
  */
7
- export interface RParameter<Info = NoInfo> extends Base<Info>, Location {
7
+ export interface RParameter<Info = NoInfo> extends RAstNodeBase<Info>, Location {
8
8
  readonly type: RType.Parameter;
9
9
  name: RSymbol<Info>;
10
10
  /** is it the special ... parameter? */
@@ -1,9 +1,9 @@
1
- import type { Base, Location, NoInfo, RNode } from '../model';
1
+ import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
2
2
  import type { RType } from '../type';
3
3
  /**
4
4
  * Variant of the binary operator, specifically for the new, built-in pipe operator.
5
5
  */
6
- export interface RPipe<Info = NoInfo> extends Base<Info>, Location {
6
+ export interface RPipe<Info = NoInfo> extends RAstNodeBase<Info>, Location {
7
7
  readonly type: RType.Pipe;
8
8
  readonly lhs: RNode<Info>;
9
9
  readonly rhs: RNode<Info>;
@@ -1,4 +1,4 @@
1
- import type { Base, Location, NoInfo } from '../model';
1
+ import type { RAstNodeBase, Location, NoInfo } from '../model';
2
2
  import type { RType } from '../type';
3
3
  import type { RExpressionList } from './r-expression-list';
4
4
  /**
@@ -6,7 +6,7 @@ import type { RExpressionList } from './r-expression-list';
6
6
  * repeat <body>
7
7
  * ```
8
8
  */
9
- export interface RRepeatLoop<Info = NoInfo> extends Base<Info>, Location {
9
+ export interface RRepeatLoop<Info = NoInfo> extends RAstNodeBase<Info>, Location {
10
10
  readonly type: RType.RepeatLoop;
11
11
  body: RExpressionList<Info>;
12
12
  }
@@ -1,9 +1,9 @@
1
- import type { Base, Location, NoInfo, RNode } from '../model';
1
+ import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
2
2
  import type { RType } from '../type';
3
3
  /**
4
4
  * Unary operations like `+` and `-`
5
5
  */
6
- export interface RUnaryOp<Info = NoInfo> extends Base<Info>, Location {
6
+ export interface RUnaryOp<Info = NoInfo> extends RAstNodeBase<Info>, Location {
7
7
  readonly type: RType.UnaryOp;
8
8
  operator: string;
9
9
  operand: RNode<Info>;
@@ -1,4 +1,4 @@
1
- import type { Base, Location, NoInfo, RNode } from '../model';
1
+ import type { RAstNodeBase, Location, NoInfo, RNode } from '../model';
2
2
  import type { RType } from '../type';
3
3
  import type { RExpressionList } from './r-expression-list';
4
4
  /**
@@ -6,7 +6,7 @@ import type { RExpressionList } from './r-expression-list';
6
6
  * while(<condition>) <body>
7
7
  * ```
8
8
  */
9
- export interface RWhileLoop<Info = NoInfo> extends Base<Info>, Location {
9
+ export interface RWhileLoop<Info = NoInfo> extends RAstNodeBase<Info>, Location {
10
10
  readonly type: RType.WhileLoop;
11
11
  condition: RNode<Info>;
12
12
  body: RExpressionList<Info>;
@@ -16,7 +16,6 @@ function normalizeComment(data, obj) {
16
16
  return {
17
17
  type: type_1.RType.Comment,
18
18
  location,
19
- content: content.slice(1),
20
19
  lexeme: content,
21
20
  info: {
22
21
  fullRange: data.currentRange,
@@ -552,7 +552,6 @@ function convertTreeNode(node) {
552
552
  return {
553
553
  type: type_1.RType.Comment,
554
554
  location: range,
555
- content: node.text.slice(1),
556
555
  lexeme: node.text,
557
556
  ...defaultInfo
558
557
  };
@@ -594,7 +593,6 @@ function splitComments(nodes) {
594
593
  comments.push([node, {
595
594
  type: type_1.RType.Comment,
596
595
  location: makeSourceRange(node),
597
- content: node.text.slice(1),
598
596
  lexeme: node.text,
599
597
  info: {
600
598
  additionalTokens: [],
@@ -0,0 +1,218 @@
1
+ import type { SourceLocation } from '../../util/range';
2
+ import type { NodeId } from '../lang-4.x/ast/model/processing/node-id';
3
+ /**
4
+ * Known Roxygen tags as per {@link https://roxygen2.r-lib.org/reference/index.html}
5
+ */
6
+ export declare enum KnownRoxygenTags {
7
+ Aliases = "aliases",
8
+ Backref = "backref",
9
+ Concept = "concept",
10
+ Family = "family",
11
+ Keywords = "keywords",
12
+ References = "references",
13
+ SeeAlso = "seealso",
14
+ EvalNamespace = "evalNamespace",
15
+ Export = "export",
16
+ ExportClass = "exportClass",
17
+ ExportMethod = "exportMethod",
18
+ ExportPattern = "exportPattern",
19
+ ExportS3Method = "exportS3Method",
20
+ Import = "import",
21
+ ImportClassesFrom = "importClassesFrom",
22
+ ImportMethodsFrom = "importMethodsFrom",
23
+ ImportFrom = "importFrom",
24
+ RawNamespace = "rawNamespace",
25
+ UseDynLib = "useDynLib",
26
+ Md = "md",
27
+ NoMd = "noMd",
28
+ Section = "section",
29
+ Field = "field",
30
+ Format = "format",
31
+ Method = "method",
32
+ Slot = "slot",
33
+ Source = "source",
34
+ Description = "description",
35
+ Details = "details",
36
+ Example = "example",
37
+ Examples = "examples",
38
+ ExamplesIf = "examplesIf",
39
+ NoRd = "noRd",
40
+ Param = "param",
41
+ RawRd = "rawRd",
42
+ Return = "return",
43
+ Returns = "returns",
44
+ Title = "title",
45
+ Usage = "usage",
46
+ DescribeIn = "describeIn",
47
+ Eval = "eval",
48
+ EvalRd = "evalRd",
49
+ IncludeRmd = "includeRmd",
50
+ Inherit = "inherit",
51
+ InheritDotParams = "inheritDotParams",
52
+ InheritParams = "inheritParams",
53
+ InheritSection = "inheritSection",
54
+ Order = "order",
55
+ RdName = "rdname",
56
+ Template = "template",
57
+ TemplateVar = "templateVar",
58
+ /** Just plain old text */
59
+ Text = "text",
60
+ Name = "name",
61
+ DocType = "docType",
62
+ Author = "author",
63
+ Unknown = "unknown"
64
+ }
65
+ /**
66
+ * Base interface for all roxygen tags.
67
+ */
68
+ export interface RoxygenTagBase<Type extends KnownRoxygenTags> {
69
+ /** The type of the roxygen tag. */
70
+ type: Type;
71
+ }
72
+ interface RoxygenTagWithValue<Type extends KnownRoxygenTags, Value> extends RoxygenTagBase<Type> {
73
+ /** The value of the roxygen tag. */
74
+ value: Value;
75
+ }
76
+ type RoxygenTagFlag<Type extends KnownRoxygenTags> = RoxygenTagBase<Type>;
77
+ export type RoxygenTagAlias = RoxygenTagWithValue<KnownRoxygenTags.Aliases, string[]>;
78
+ export type RoxygenTagBackref = RoxygenTagWithValue<KnownRoxygenTags.Backref, string>;
79
+ export type RoxygenTagConcept = RoxygenTagWithValue<KnownRoxygenTags.Concept, string>;
80
+ export type RoxygenTagFamily = RoxygenTagWithValue<KnownRoxygenTags.Family, string>;
81
+ /** Internal is special in that it causes the topic to be removed from the index */
82
+ export type RoxygenTagKeywords = RoxygenTagWithValue<KnownRoxygenTags.Keywords, (string | 'internal')[]>;
83
+ export type RoxygenTagReferences = RoxygenTagWithValue<KnownRoxygenTags.References, string>;
84
+ export type RoxygenTagSeeAlso = RoxygenTagWithValue<KnownRoxygenTags.SeeAlso, string[]>;
85
+ /** https://roxygen2.r-lib.org/reference/tags-index-crossref.html */
86
+ export type RoxygenCrossrefTag = RoxygenTagAlias | RoxygenTagBackref | RoxygenTagConcept | RoxygenTagFamily | RoxygenTagKeywords | RoxygenTagReferences | RoxygenTagSeeAlso;
87
+ /** Evaluate arbitrary code in the package namespace and insert the results into the NAMESPACE */
88
+ export type RoxygenTagEvalNamespace = RoxygenTagWithValue<KnownRoxygenTags.EvalNamespace, string>;
89
+ export type RoxygenTagExport = RoxygenTagFlag<KnownRoxygenTags.Export>;
90
+ export type RoxygenTagExportClass = RoxygenTagWithValue<KnownRoxygenTags.ExportClass, string>;
91
+ export type RoxygenTagExportMethod = RoxygenTagWithValue<KnownRoxygenTags.ExportMethod, string>;
92
+ export type RoxygenTagExportPattern = RoxygenTagWithValue<KnownRoxygenTags.ExportPattern, string>;
93
+ export type RoxygenTagExportS3Method = RoxygenTagWithValue<KnownRoxygenTags.ExportS3Method, string>;
94
+ export type RoxygenTagImport = RoxygenTagWithValue<KnownRoxygenTags.Import, string>;
95
+ export type RoxygenTagImportClassesFrom = RoxygenTagWithValue<KnownRoxygenTags.ImportClassesFrom, {
96
+ package: string;
97
+ classes: string[];
98
+ }>;
99
+ export type RoxygenTagImportMethodsFrom = RoxygenTagWithValue<KnownRoxygenTags.ImportMethodsFrom, {
100
+ package: string;
101
+ methods: string[];
102
+ }>;
103
+ export type RoxygenTagImportFrom = RoxygenTagWithValue<KnownRoxygenTags.ImportFrom, {
104
+ package: string;
105
+ symbols: string[];
106
+ }>;
107
+ /** Insert literal text directly into the NAMESPACE */
108
+ export type RoxygenTagRawNamespace = RoxygenTagWithValue<KnownRoxygenTags.RawNamespace, string>;
109
+ export type RoxygenTagUseDynLib = RoxygenTagWithValue<KnownRoxygenTags.UseDynLib, string>;
110
+ /** https://roxygen2.r-lib.org/reference/tags-namespace.html */
111
+ export type RoxygenNamespaceTag = RoxygenTagEvalNamespace | RoxygenTagExport | RoxygenTagExportClass | RoxygenTagExportMethod | RoxygenTagExportPattern | RoxygenTagExportS3Method | RoxygenTagImport | RoxygenTagImportClassesFrom | RoxygenTagImportMethodsFrom | RoxygenTagImportFrom | RoxygenTagRawNamespace | RoxygenTagUseDynLib;
112
+ export type RoxygenTagMarkdown = RoxygenTagFlag<KnownRoxygenTags.Md>;
113
+ export type RoxygenTagNoMarkdown = RoxygenTagFlag<KnownRoxygenTags.NoMd>;
114
+ export type RoxygenTagSection = RoxygenTagWithValue<KnownRoxygenTags.Section, {
115
+ title: string;
116
+ content: string;
117
+ }>;
118
+ /** https://roxygen2.r-lib.org/reference/tags-rd-formatting.html */
119
+ export type RoxygenFormattingTag = RoxygenTagMarkdown | RoxygenTagNoMarkdown | RoxygenTagSection;
120
+ export type RoxygenTagField = RoxygenTagWithValue<KnownRoxygenTags.Field, {
121
+ name: string;
122
+ description: string;
123
+ }>;
124
+ export type RoxygenTagFormat = RoxygenTagWithValue<KnownRoxygenTags.Format, string>;
125
+ export type RoxygenTagMethod = RoxygenTagWithValue<KnownRoxygenTags.Method, {
126
+ generic: string;
127
+ class: string;
128
+ }>;
129
+ export type RoxygenTagSlot = RoxygenTagWithValue<KnownRoxygenTags.Slot, {
130
+ name: string;
131
+ description: string;
132
+ }>;
133
+ export type RoxygenTagSource = RoxygenTagWithValue<KnownRoxygenTags.Source, string>;
134
+ /** https://roxygen2.r-lib.org/reference/tags-rd-other.html */
135
+ export type RoxygenDatasetDocumentationTag = RoxygenTagField | RoxygenTagFormat | RoxygenTagMethod | RoxygenTagSlot | RoxygenTagSource;
136
+ export type RoxygenTagDescription = RoxygenTagWithValue<KnownRoxygenTags.Description, string>;
137
+ export type RoxygenTagDetails = RoxygenTagWithValue<KnownRoxygenTags.Details, string>;
138
+ /** Embed example from file */
139
+ export type RoxygenTagExample = RoxygenTagWithValue<KnownRoxygenTags.Example, string>;
140
+ export type RoxygenTagExamples = RoxygenTagWithValue<KnownRoxygenTags.Examples, string>;
141
+ export type RoxygenTagExamplesIf = RoxygenTagWithValue<KnownRoxygenTags.ExamplesIf, {
142
+ condition: string;
143
+ content: string;
144
+ }>;
145
+ export type RoxygenTagNoRd = RoxygenTagFlag<KnownRoxygenTags.NoRd>;
146
+ export type RoxygenTagParam = RoxygenTagWithValue<KnownRoxygenTags.Param, {
147
+ name: string;
148
+ description: string;
149
+ }>;
150
+ /** Insert literal Rd code */
151
+ export type RoxygenTagRawRd = RoxygenTagWithValue<KnownRoxygenTags.RawRd, string>;
152
+ export type RoxygenTagReturn = RoxygenTagWithValue<KnownRoxygenTags.Return | KnownRoxygenTags.Returns, string>;
153
+ export type RoxygenTagTitle = RoxygenTagWithValue<KnownRoxygenTags.Title, string>;
154
+ export type RoxygenTagUsage = RoxygenTagWithValue<KnownRoxygenTags.Usage, string>;
155
+ /** https://roxygen2.r-lib.org/reference/tags-rd.html */
156
+ export type RoxygenFunctionDocumentationTag = RoxygenTagDescription | RoxygenTagDetails | RoxygenTagExample | RoxygenTagExamples | RoxygenTagExamplesIf | RoxygenTagNoRd | RoxygenTagParam | RoxygenTagRawRd | RoxygenTagReturn | RoxygenTagTitle | RoxygenTagUsage;
157
+ export type RoxygenTagDescribeIn = RoxygenTagWithValue<KnownRoxygenTags.DescribeIn, {
158
+ dest: string;
159
+ description: string;
160
+ }>;
161
+ /** Evaluate R code and insert the results into the Rd file */
162
+ export type RoxygenTagEval = RoxygenTagWithValue<KnownRoxygenTags.Eval, string>;
163
+ export type RoxygenTagEvalRd = RoxygenTagWithValue<KnownRoxygenTags.EvalRd, string>;
164
+ export type RoxygenTagIncludeRmd = RoxygenTagWithValue<KnownRoxygenTags.IncludeRmd, string>;
165
+ export type RoxygenTagInherit = RoxygenTagWithValue<KnownRoxygenTags.Inherit, {
166
+ source: string;
167
+ components: string[];
168
+ }>;
169
+ export type RoxygenTagInheritDotParams = RoxygenTagWithValue<KnownRoxygenTags.InheritDotParams, {
170
+ source: string;
171
+ args: string[];
172
+ }>;
173
+ export type RoxygenTagInheritParams = RoxygenTagWithValue<KnownRoxygenTags.InheritParams, string>;
174
+ export type RoxygenTagInheritSection = RoxygenTagWithValue<KnownRoxygenTags.InheritSection, {
175
+ source: string;
176
+ section: string;
177
+ }>;
178
+ export type RoxygenTagOrder = RoxygenTagWithValue<KnownRoxygenTags.Order, number | undefined>;
179
+ export type RoxygenTagRdName = RoxygenTagWithValue<KnownRoxygenTags.RdName, string>;
180
+ export type RoxygenTagTemplate = RoxygenTagWithValue<KnownRoxygenTags.Template, string>;
181
+ export type RoxygenTagTemplateVar = RoxygenTagWithValue<KnownRoxygenTags.TemplateVar, {
182
+ name: string;
183
+ value: string;
184
+ }>;
185
+ /** https://roxygen2.r-lib.org/reference/tags-reuse.html */
186
+ export type RoxygenReusingDocumentationTag = RoxygenTagDescribeIn | RoxygenTagEval | RoxygenTagEvalRd | RoxygenTagIncludeRmd | RoxygenTagInherit | RoxygenTagInheritDotParams | RoxygenTagInheritParams | RoxygenTagInheritSection | RoxygenTagOrder | RoxygenTagRdName | RoxygenTagTemplate | RoxygenTagTemplateVar;
187
+ export type RoxygenUnknownTag = RoxygenTagWithValue<KnownRoxygenTags.Unknown, {
188
+ tag: string;
189
+ content: string;
190
+ }>;
191
+ export type RoxygenTagAuthor = RoxygenTagWithValue<KnownRoxygenTags.Author, string>;
192
+ export type RoxygenDocType = RoxygenTagWithValue<KnownRoxygenTags.DocType, string>;
193
+ export type RoxygenTagName = RoxygenTagWithValue<KnownRoxygenTags.Name, string>;
194
+ export type RoxygenTagText = RoxygenTagWithValue<KnownRoxygenTags.Text, string>;
195
+ export type RoxygenOtherTag = RoxygenTagAuthor | RoxygenUnknownTag | RoxygenDocType | RoxygenTagName | RoxygenTagText;
196
+ /**
197
+ * All known Roxygen tag types.
198
+ */
199
+ export type RoxygenTag = RoxygenCrossrefTag | RoxygenNamespaceTag | RoxygenFormattingTag | RoxygenDatasetDocumentationTag | RoxygenFunctionDocumentationTag | RoxygenReusingDocumentationTag | RoxygenOtherTag;
200
+ /**
201
+ * A roxygen comment block, consisting of multiple {@link RoxygenTag|roxygen tags}.
202
+ */
203
+ export interface RoxygenBlock {
204
+ readonly type: 'roxygen-block';
205
+ /** The ast node to which we assign the comment */
206
+ readonly requestNode: NodeId;
207
+ /** The AST node ID of the R node this roxygen block is attached to, if any (this comment may be a parent of the requested) */
208
+ readonly attachedTo?: NodeId;
209
+ /** The source location of the entire roxygen block, if available. */
210
+ readonly range?: SourceLocation;
211
+ /** The roxygen tags contained in this block. */
212
+ readonly tags: readonly RoxygenTag[];
213
+ }
214
+ /**
215
+ * Checks whether the given text is a known roxygen tag.
216
+ */
217
+ export declare function isKnownRoxygenText(text: string): text is KnownRoxygenTags;
218
+ export {};
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KnownRoxygenTags = void 0;
4
+ exports.isKnownRoxygenText = isKnownRoxygenText;
5
+ /**
6
+ * Known Roxygen tags as per {@link https://roxygen2.r-lib.org/reference/index.html}
7
+ */
8
+ var KnownRoxygenTags;
9
+ (function (KnownRoxygenTags) {
10
+ /* ---- Tags Index Crossref ---- */
11
+ KnownRoxygenTags["Aliases"] = "aliases";
12
+ KnownRoxygenTags["Backref"] = "backref";
13
+ KnownRoxygenTags["Concept"] = "concept";
14
+ KnownRoxygenTags["Family"] = "family";
15
+ KnownRoxygenTags["Keywords"] = "keywords";
16
+ KnownRoxygenTags["References"] = "references";
17
+ KnownRoxygenTags["SeeAlso"] = "seealso";
18
+ /* ---- Tags Namespace ---- */
19
+ KnownRoxygenTags["EvalNamespace"] = "evalNamespace";
20
+ KnownRoxygenTags["Export"] = "export";
21
+ KnownRoxygenTags["ExportClass"] = "exportClass";
22
+ KnownRoxygenTags["ExportMethod"] = "exportMethod";
23
+ KnownRoxygenTags["ExportPattern"] = "exportPattern";
24
+ KnownRoxygenTags["ExportS3Method"] = "exportS3Method";
25
+ KnownRoxygenTags["Import"] = "import";
26
+ KnownRoxygenTags["ImportClassesFrom"] = "importClassesFrom";
27
+ KnownRoxygenTags["ImportMethodsFrom"] = "importMethodsFrom";
28
+ KnownRoxygenTags["ImportFrom"] = "importFrom";
29
+ KnownRoxygenTags["RawNamespace"] = "rawNamespace";
30
+ KnownRoxygenTags["UseDynLib"] = "useDynLib";
31
+ /* ---- Tags related to Markdown formatting ---- */
32
+ KnownRoxygenTags["Md"] = "md";
33
+ KnownRoxygenTags["NoMd"] = "noMd";
34
+ KnownRoxygenTags["Section"] = "section";
35
+ /* ---- Documenting Datasets and Classes ---- */
36
+ KnownRoxygenTags["Field"] = "field";
37
+ KnownRoxygenTags["Format"] = "format";
38
+ KnownRoxygenTags["Method"] = "method";
39
+ KnownRoxygenTags["Slot"] = "slot";
40
+ KnownRoxygenTags["Source"] = "source";
41
+ /* ---- Documenting Functions ---- */
42
+ KnownRoxygenTags["Description"] = "description";
43
+ KnownRoxygenTags["Details"] = "details";
44
+ KnownRoxygenTags["Example"] = "example";
45
+ KnownRoxygenTags["Examples"] = "examples";
46
+ KnownRoxygenTags["ExamplesIf"] = "examplesIf";
47
+ KnownRoxygenTags["NoRd"] = "noRd";
48
+ KnownRoxygenTags["Param"] = "param";
49
+ KnownRoxygenTags["RawRd"] = "rawRd";
50
+ KnownRoxygenTags["Return"] = "return";
51
+ KnownRoxygenTags["Returns"] = "returns";
52
+ KnownRoxygenTags["Title"] = "title";
53
+ KnownRoxygenTags["Usage"] = "usage";
54
+ /* ---- Reusing Documentation ---- */
55
+ KnownRoxygenTags["DescribeIn"] = "describeIn";
56
+ KnownRoxygenTags["Eval"] = "eval";
57
+ KnownRoxygenTags["EvalRd"] = "evalRd";
58
+ KnownRoxygenTags["IncludeRmd"] = "includeRmd";
59
+ KnownRoxygenTags["Inherit"] = "inherit";
60
+ KnownRoxygenTags["InheritDotParams"] = "inheritDotParams";
61
+ KnownRoxygenTags["InheritParams"] = "inheritParams";
62
+ KnownRoxygenTags["InheritSection"] = "inheritSection";
63
+ KnownRoxygenTags["Order"] = "order";
64
+ KnownRoxygenTags["RdName"] = "rdname";
65
+ KnownRoxygenTags["Template"] = "template";
66
+ KnownRoxygenTags["TemplateVar"] = "templateVar";
67
+ /* ---- Other, not part of the references above ---- */
68
+ /** Just plain old text */
69
+ KnownRoxygenTags["Text"] = "text";
70
+ KnownRoxygenTags["Name"] = "name";
71
+ KnownRoxygenTags["DocType"] = "docType";
72
+ KnownRoxygenTags["Author"] = "author";
73
+ KnownRoxygenTags["Unknown"] = "unknown";
74
+ })(KnownRoxygenTags || (exports.KnownRoxygenTags = KnownRoxygenTags = {}));
75
+ const ValidRoxygenTagsSet = new Set(Object.values(KnownRoxygenTags));
76
+ /**
77
+ * Checks whether the given text is a known roxygen tag.
78
+ */
79
+ function isKnownRoxygenText(text) {
80
+ return ValidRoxygenTagsSet.has(text);
81
+ }
82
+ //# sourceMappingURL=roxygen-ast.js.map
@@ -0,0 +1,24 @@
1
+ import type { RoxygenBlock, RoxygenTag } from './roxygen-ast';
2
+ import type { RNode } from '../lang-4.x/ast/model/model';
3
+ import type { AstIdMap, ParentInformation } from '../lang-4.x/ast/model/processing/decorate';
4
+ /**
5
+ * Parses the roxygen comments attached to a node into a RoxygenBlock AST node.
6
+ * Will return `undefined` if there are no valid roxygen comments attached to the node.
7
+ * @param node - The node to parse the roxygen comments for
8
+ * @param idMap - An optional id map to traverse up the AST to find comments attached to parent nodes
9
+ */
10
+ export declare function parseRoxygenCommentsOfNode(node: RNode<ParentInformation>, idMap?: AstIdMap): RoxygenBlock | undefined;
11
+ interface RoxygenParseContext {
12
+ lines: string[];
13
+ tags: RoxygenTag[];
14
+ idx: number;
15
+ }
16
+ type TagLine = [tag: string, remTagLine?: string];
17
+ /**
18
+ * Parses a roxygen comment into a RoxygenBlock AST node.
19
+ * Will return an empty array if the comment has no valid roxygen comment.
20
+ * @see {@link parseRoxygenCommentsOfNode} - to parse comments attached to a node
21
+ */
22
+ export declare function parseRoxygenComment(commentText: readonly string[]): RoxygenTag[];
23
+ export declare const firstAndRest: (firstName: string, secondName: string) => (s: RoxygenParseContext, t: TagLine) => void;
24
+ export {};