@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
27 lines (26 loc) • 1.51 kB
TypeScript
import type { RoxygenBlock, RoxygenTag } from './roxygen-ast';
import type { RNode } from '../lang-4.x/ast/model/model';
import type { AstIdMap, ParentInformation } from '../lang-4.x/ast/model/processing/decorate';
/**
* Parses the roxygen comments attached to a node into a RoxygenBlock AST node.
* Will return `undefined` if there are no valid roxygen comments attached to the node.
* Please note that this does *not* do any clever mapping of parameters or requests.
* For a higher-level function that also traverses up the AST to find comments attached to parent nodes, see {@link getDocumentationOf}.
* @param node - The node to parse the roxygen comments for
* @param idMap - An optional id map to traverse up the AST to find comments attached to parent nodes
*/
export declare function parseRoxygenCommentsOfNode(node: RNode<ParentInformation>, idMap?: AstIdMap): RoxygenBlock | undefined;
interface RoxygenParseContext {
lines: string[];
tags: RoxygenTag[];
idx: number;
}
type TagLine = [tag: string, remTagLine?: string];
/**
* Parses a roxygen comment into a RoxygenBlock AST node.
* Will return an empty array if the comment has no valid roxygen comment.
* @see {@link parseRoxygenCommentsOfNode} - to parse comments attached to a node
*/
export declare function parseRoxygenComment(commentText: readonly string[]): RoxygenTag[];
export declare const firstAndRest: (firstName: string, secondName: string) => (s: RoxygenParseContext, t: TagLine) => TagLine | undefined;
export {};