@eagleoutice/flowr 2.7.5 → 2.8.0

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 +68 -65
  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 +614 -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 +209 -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 +155 -53
  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 -11
  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 +11 -3
  107. package/project/plugins/file-plugins/files/flowr-description-file.js +38 -28
  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 -28
  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 +8 -3
  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 +32 -0
  200. package/util/r-license.js +217 -0
  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
@@ -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 {};
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.firstAndRest = void 0;
4
+ exports.parseRoxygenCommentsOfNode = parseRoxygenCommentsOfNode;
5
+ exports.parseRoxygenComment = parseRoxygenComment;
6
+ const roxygen_ast_1 = require("./roxygen-ast");
7
+ const r_comment_1 = require("../lang-4.x/ast/model/nodes/r-comment");
8
+ const assert_1 = require("../../util/assert");
9
+ const args_1 = require("../../util/text/args");
10
+ const range_1 = require("../../util/range");
11
+ function prepareCommentContext(commentText) {
12
+ const contents = [];
13
+ for (const line of commentText) {
14
+ const trimmed = line.trim();
15
+ if (trimmed.length === 0) {
16
+ continue;
17
+ }
18
+ else if (!trimmed.startsWith('#')) {
19
+ // we are done with the roxygen comment
20
+ break;
21
+ }
22
+ contents.push((trimmed.startsWith('#\'') ? trimmed.slice(2) : trimmed.slice(1)).trimEnd());
23
+ }
24
+ return contents;
25
+ }
26
+ /**
27
+ * Parses the roxygen comments attached to a node into a RoxygenBlock AST node.
28
+ * Will return `undefined` if there are no valid roxygen comments attached to the node.
29
+ * @param node - The node to parse the roxygen comments for
30
+ * @param idMap - An optional id map to traverse up the AST to find comments attached to parent nodes
31
+ */
32
+ function parseRoxygenCommentsOfNode(node, idMap) {
33
+ let comments;
34
+ let cur = node;
35
+ do {
36
+ comments = cur?.info.additionalTokens
37
+ ?.filter(r_comment_1.isRComment).filter(r => (0, assert_1.isNotUndefined)(r.lexeme));
38
+ cur = cur?.info.parent ? idMap?.get(cur.info.parent) : undefined;
39
+ } while ((comments === undefined || comments.length === 0) && cur !== undefined);
40
+ if (comments === undefined || comments.length === 0) {
41
+ return undefined;
42
+ }
43
+ const commentContent = comments.map(c => c.lexeme);
44
+ return {
45
+ type: 'roxygen-block',
46
+ tags: parseRoxygenComment(commentContent),
47
+ attachedTo: cur?.info.id,
48
+ requestNode: node.info.id,
49
+ range: [
50
+ ...(0, range_1.mergeRanges)(...comments.map(c => c.location)),
51
+ comments.find(c => c.info.file)?.info.file
52
+ ]
53
+ };
54
+ }
55
+ /**
56
+ * Parses a roxygen comment into a RoxygenBlock AST node.
57
+ * Will return an empty array if the comment has no valid roxygen comment.
58
+ * @see {@link parseRoxygenCommentsOfNode} - to parse comments attached to a node
59
+ */
60
+ function parseRoxygenComment(commentText) {
61
+ const contents = prepareCommentContext(commentText);
62
+ const state = {
63
+ lines: contents,
64
+ tags: [],
65
+ idx: 0
66
+ };
67
+ val(state, [roxygen_ast_1.KnownRoxygenTags.Text]);
68
+ return state.tags;
69
+ }
70
+ function atEnd(state) {
71
+ return state.idx >= state.lines.length;
72
+ }
73
+ function atTag(state) {
74
+ if (atEnd(state)) {
75
+ return undefined;
76
+ }
77
+ const line = state.lines[state.idx].trim();
78
+ if (!line.startsWith('@')) {
79
+ return undefined;
80
+ }
81
+ const firstSpace = line.indexOf(' ');
82
+ return firstSpace === -1 ? [line.slice(1), undefined] : [line.slice(1, firstSpace), line.slice(firstSpace + 1).trim()];
83
+ }
84
+ function advanceLine(state) {
85
+ return state.lines[state.idx++];
86
+ }
87
+ function collectUntilNextTag(state) {
88
+ const collected = [];
89
+ while (!atEnd(state)) {
90
+ const mayTag = atTag(state);
91
+ if (mayTag) {
92
+ advanceLine(state);
93
+ return [collected, mayTag];
94
+ }
95
+ collected.push(advanceLine(state));
96
+ }
97
+ return [collected, undefined];
98
+ }
99
+ function addTag(state, tag) {
100
+ state.tags.push(tag);
101
+ }
102
+ function val(state, tagName, lineToVal = l => l.join('\n').trim()) {
103
+ const [lines, nextTag] = collectUntilNextTag(state);
104
+ if (tagName[1]) {
105
+ lines.unshift(tagName[1]);
106
+ }
107
+ if (tagName[0] !== roxygen_ast_1.KnownRoxygenTags.Text || lines.length > 0) {
108
+ const n = tagName[0];
109
+ if ((0, roxygen_ast_1.isKnownRoxygenText)(n)) {
110
+ const val = lineToVal(lines);
111
+ addTag(state, (val !== undefined ? {
112
+ type: n,
113
+ value: val
114
+ } : { type: n }));
115
+ }
116
+ else {
117
+ addTag(state, {
118
+ type: roxygen_ast_1.KnownRoxygenTags.Unknown,
119
+ value: {
120
+ tag: n,
121
+ content: lines.join(' ')
122
+ }
123
+ });
124
+ }
125
+ }
126
+ parseRoxygenTag(state, nextTag);
127
+ }
128
+ const spaceVals = (s, t) => val(s, t, l => (0, args_1.splitAtEscapeSensitive)(l.join(' ')));
129
+ const flagVal = (s, t) => val(s, t, () => undefined);
130
+ const section = (s, t) => val(s, t, l => {
131
+ return { title: l[0].trim(), content: l.slice(1).join('\n').trim() };
132
+ });
133
+ const firstAndRest = (firstName, secondName) => (s, t) => val(s, t, l => {
134
+ const vals = (0, args_1.splitAtEscapeSensitive)(l.join('\n'));
135
+ return { [firstName]: vals[0], [secondName]: vals.slice(1).join(' ').trim() };
136
+ });
137
+ exports.firstAndRest = firstAndRest;
138
+ const firstAndArrayRest = (firstName, secondName) => (s, t) => val(s, t, l => {
139
+ const vals = (0, args_1.splitAtEscapeSensitive)(l.join('\n'));
140
+ return { [firstName]: vals[0], [secondName]: vals.slice(1) };
141
+ });
142
+ const asNumber = (s, t) => val(s, t, l => {
143
+ const num = Number(l.join(' ').trim());
144
+ return Number.isNaN(num) ? undefined : num;
145
+ });
146
+ const TagMap = {
147
+ [roxygen_ast_1.KnownRoxygenTags.Aliases]: spaceVals,
148
+ [roxygen_ast_1.KnownRoxygenTags.Backref]: val,
149
+ [roxygen_ast_1.KnownRoxygenTags.Concept]: val,
150
+ [roxygen_ast_1.KnownRoxygenTags.Family]: val,
151
+ [roxygen_ast_1.KnownRoxygenTags.Keywords]: spaceVals,
152
+ [roxygen_ast_1.KnownRoxygenTags.References]: val,
153
+ [roxygen_ast_1.KnownRoxygenTags.SeeAlso]: spaceVals,
154
+ [roxygen_ast_1.KnownRoxygenTags.EvalNamespace]: val,
155
+ [roxygen_ast_1.KnownRoxygenTags.Export]: flagVal,
156
+ [roxygen_ast_1.KnownRoxygenTags.ExportClass]: val,
157
+ [roxygen_ast_1.KnownRoxygenTags.ExportMethod]: val,
158
+ [roxygen_ast_1.KnownRoxygenTags.ExportPattern]: val,
159
+ [roxygen_ast_1.KnownRoxygenTags.ExportS3Method]: val,
160
+ [roxygen_ast_1.KnownRoxygenTags.Import]: val,
161
+ [roxygen_ast_1.KnownRoxygenTags.ImportClassesFrom]: firstAndArrayRest('package', 'classes'),
162
+ [roxygen_ast_1.KnownRoxygenTags.ImportMethodsFrom]: firstAndArrayRest('package', 'methods'),
163
+ [roxygen_ast_1.KnownRoxygenTags.ImportFrom]: firstAndArrayRest('package', 'symbols'),
164
+ [roxygen_ast_1.KnownRoxygenTags.RawNamespace]: val,
165
+ [roxygen_ast_1.KnownRoxygenTags.UseDynLib]: val,
166
+ [roxygen_ast_1.KnownRoxygenTags.Md]: flagVal,
167
+ [roxygen_ast_1.KnownRoxygenTags.NoMd]: flagVal,
168
+ [roxygen_ast_1.KnownRoxygenTags.Section]: section,
169
+ [roxygen_ast_1.KnownRoxygenTags.Field]: (0, exports.firstAndRest)('name', 'description'),
170
+ [roxygen_ast_1.KnownRoxygenTags.Format]: val,
171
+ [roxygen_ast_1.KnownRoxygenTags.Method]: (0, exports.firstAndRest)('generic', 'class'),
172
+ [roxygen_ast_1.KnownRoxygenTags.Slot]: (0, exports.firstAndRest)('name', 'description'),
173
+ [roxygen_ast_1.KnownRoxygenTags.Source]: val,
174
+ [roxygen_ast_1.KnownRoxygenTags.Description]: val,
175
+ [roxygen_ast_1.KnownRoxygenTags.Details]: val,
176
+ [roxygen_ast_1.KnownRoxygenTags.Example]: val,
177
+ [roxygen_ast_1.KnownRoxygenTags.Examples]: val,
178
+ [roxygen_ast_1.KnownRoxygenTags.ExamplesIf]: (0, exports.firstAndRest)('condition', 'content'),
179
+ [roxygen_ast_1.KnownRoxygenTags.NoRd]: flagVal,
180
+ [roxygen_ast_1.KnownRoxygenTags.Param]: (0, exports.firstAndRest)('name', 'description'),
181
+ [roxygen_ast_1.KnownRoxygenTags.RawRd]: val,
182
+ [roxygen_ast_1.KnownRoxygenTags.Return]: val,
183
+ [roxygen_ast_1.KnownRoxygenTags.Returns]: val,
184
+ [roxygen_ast_1.KnownRoxygenTags.Title]: val,
185
+ [roxygen_ast_1.KnownRoxygenTags.Usage]: val,
186
+ [roxygen_ast_1.KnownRoxygenTags.DescribeIn]: (0, exports.firstAndRest)('dest', 'description'),
187
+ [roxygen_ast_1.KnownRoxygenTags.Eval]: val,
188
+ [roxygen_ast_1.KnownRoxygenTags.EvalRd]: val,
189
+ [roxygen_ast_1.KnownRoxygenTags.IncludeRmd]: val,
190
+ [roxygen_ast_1.KnownRoxygenTags.Inherit]: firstAndArrayRest('source', 'components'),
191
+ [roxygen_ast_1.KnownRoxygenTags.InheritDotParams]: firstAndArrayRest('source', 'args'),
192
+ [roxygen_ast_1.KnownRoxygenTags.InheritParams]: val,
193
+ [roxygen_ast_1.KnownRoxygenTags.InheritSection]: (0, exports.firstAndRest)('source', 'section'),
194
+ [roxygen_ast_1.KnownRoxygenTags.Order]: asNumber,
195
+ [roxygen_ast_1.KnownRoxygenTags.RdName]: val,
196
+ [roxygen_ast_1.KnownRoxygenTags.Template]: val,
197
+ [roxygen_ast_1.KnownRoxygenTags.TemplateVar]: (0, exports.firstAndRest)('name', 'value'),
198
+ [roxygen_ast_1.KnownRoxygenTags.Text]: val,
199
+ [roxygen_ast_1.KnownRoxygenTags.Name]: val,
200
+ [roxygen_ast_1.KnownRoxygenTags.DocType]: val,
201
+ [roxygen_ast_1.KnownRoxygenTags.Author]: val,
202
+ [roxygen_ast_1.KnownRoxygenTags.Unknown]: (s, t) => val(s, t, l => ({
203
+ tag: t[0],
204
+ content: l.join(' ')
205
+ }))
206
+ };
207
+ function parseRoxygenTag(state, tagName) {
208
+ if (tagName === undefined) {
209
+ return;
210
+ }
211
+ const parser = TagMap[tagName[0]] ?? val;
212
+ parser(state, tagName);
213
+ }
214
+ //# sourceMappingURL=roxygen-parse.js.map
@@ -31,7 +31,7 @@ const magicCommentIdMapper = {
31
31
  return ret;
32
32
  }
33
33
  };
34
- const commentTriggerRegex = / flowr@(\w+)/;
34
+ const commentTriggerRegex = /# flowr@(\w+)/;
35
35
  /**
36
36
  * This takes an {@link NormalizedAst} and returns an auto-select predicate for {@link reconstructToCode},
37
37
  * which will automatically include lines marked by these special comments!
@@ -58,11 +58,11 @@ function makeMagicCommentHandler(and) {
58
58
  return;
59
59
  }
60
60
  for (const c of comments) {
61
- if (c.type !== type_1.RType.Comment || !c.content.startsWith(' flowr@')) {
61
+ if (c.type !== type_1.RType.Comment || !c.lexeme.startsWith('# flowr@')) {
62
62
  continue;
63
63
  }
64
- const match = commentTriggerRegex.exec(c.content);
65
- (0, assert_1.guard)(match !== null, `invalid magic comment: ${c.content}`);
64
+ const match = commentTriggerRegex.exec(c.lexeme);
65
+ (0, assert_1.guard)(match !== null, `invalid magic comment: ${c.lexeme}`);
66
66
  const idMapper = magicCommentIdMapper[match[1]];
67
67
  (0, assert_1.guard)(idMapper !== undefined, `unknown magic comment: ${match[1]}`);
68
68
  const ls = idMapper(c, startLineStack);
@@ -33,7 +33,7 @@ function getAllFunctionCallTargets(dataflowGraph, callerInfo, baseEnvironment, q
33
33
  const functionCallTargets = queue.memoizeCallTargets(functionCallDefs.join(';'), () => (0, linker_1.getAllLinkedFunctionDefinitions)(new Set(functionCallDefs), dataflowGraph)[0]);
34
34
  return [functionCallTargets, activeEnvironment];
35
35
  }
36
- function includeArgumentFunctionCallClosure(arg, baseEnvironment, activeEnvironment, queue, dataflowGraph) {
36
+ function includeArgumentFunctionCallClosure(arg, activeEnvironment, queue, dataflowGraph) {
37
37
  const valueRoot = (0, graph_1.getReferenceOfArgument)(arg);
38
38
  if (!valueRoot) {
39
39
  return;
@@ -44,7 +44,7 @@ function includeArgumentFunctionCallClosure(arg, baseEnvironment, activeEnvironm
44
44
  function linkCallTargets(onlyForSideEffects, functionCallTargets, activeEnvironment, activeEnvironmentFingerprint, queue) {
45
45
  for (const functionCallTarget of functionCallTargets) {
46
46
  for (const exitPoint of functionCallTarget.exitPoints) {
47
- queue.add(exitPoint, activeEnvironment, activeEnvironmentFingerprint, onlyForSideEffects);
47
+ queue.add(exitPoint.nodeId, activeEnvironment, activeEnvironmentFingerprint, onlyForSideEffects);
48
48
  }
49
49
  // handle open reads
50
50
  for (const openIn of functionCallTarget.subflow.in) {
@@ -60,7 +60,6 @@ function linkCallTargets(onlyForSideEffects, functionCallTargets, activeEnvironm
60
60
  }
61
61
  /** returns the new threshold hit count */
62
62
  function sliceForCall(current, callerInfo, dataflowInformation, queue, ctx) {
63
- const baseEnvironment = current.baseEnvironment;
64
63
  const [functionCallTargets, activeEnvironment] = getAllFunctionCallTargets(dataflowInformation.graph, callerInfo, current.baseEnvironment, queue, ctx);
65
64
  const activeEnvironmentFingerprint = (0, fingerprint_1.envFingerprint)(activeEnvironment);
66
65
  if (functionCallTargets.size === 0) {
@@ -69,7 +68,7 @@ function sliceForCall(current, callerInfo, dataflowInformation, queue, ctx) {
69
68
  * hence, we add a new flag and add all argument values to the queue causing directly
70
69
  */
71
70
  for (const arg of callerInfo.args) {
72
- includeArgumentFunctionCallClosure(arg, baseEnvironment, activeEnvironment, queue, dataflowInformation.graph);
71
+ includeArgumentFunctionCallClosure(arg, activeEnvironment, queue, dataflowInformation.graph);
73
72
  }
74
73
  return;
75
74
  }
@@ -66,9 +66,9 @@ function staticSlice(ctx, info, { idMap }, criteria, direction, threshold = 75,
66
66
  }
67
67
  const [currentVertex, currentEdges] = currentInfo;
68
68
  // we only add control dependencies iff 1) we are in different function call or 2) they have, at least, the same nesting as the slicing seed
69
- if (currentVertex.cds && currentVertex.cds.length > 0) {
69
+ if (currentVertex.controlDependencies && currentVertex.controlDependencies.length > 0) {
70
70
  const topLevel = graph.isRoot(id) || sliceSeedIds.has(id);
71
- for (const cd of currentVertex.cds.filter(({ id }) => !queue.hasId(id))) {
71
+ for (const cd of currentVertex.controlDependencies.filter(({ id }) => !queue.hasId(id))) {
72
72
  if (!topLevel || (idMap.get(cd.id)?.info.nesting ?? 0) >= minNesting) {
73
73
  queue.add(cd.id, baseEnvironment, baseEnvFingerprint, false);
74
74
  }
@@ -57,7 +57,7 @@ function visitDefinitions(info, input) {
57
57
  }
58
58
  const [fnDefinition] = dfNode;
59
59
  (0, assert_1.guard)(fnDefinition.tag === vertex_1.VertexType.FunctionDefinition, () => `Dataflow node is not a function definition (${JSON.stringify(fnDefinition)}))})`);
60
- const returnTypes = fnDefinition.exitPoints.map(ep => graph.get(ep, true)).filter(assert_1.isNotUndefined)
60
+ const returnTypes = fnDefinition.exitPoints.map(ep => graph.get(ep.nodeId, true)).filter(assert_1.isNotUndefined)
61
61
  .map(([vertex]) => {
62
62
  const l = graph.idMap?.get(vertex.id)?.location;
63
63
  return {
@@ -25,10 +25,10 @@ export declare class DefaultMap<K, V = K> {
25
25
  /**
26
26
  * Iterates over all entries that have been set (explicitly or by the generator)
27
27
  */
28
- entries(): IterableIterator<[K, V]>;
28
+ entries(): MapIterator<[K, V]>;
29
29
  /** returns only the keys really stored in the map */
30
- keys(): IterableIterator<K>;
31
- values(): IterableIterator<V>;
30
+ keys(): MapIterator<K>;
31
+ values(): MapIterator<V>;
32
32
  delete(k: K): boolean;
33
33
  size(): number;
34
34
  }