import type { PathTarget } from "@stripe/formspec-core/internals"; import { type ExtensionTagSource } from "./tag-registry.js"; /** * Zero-based half-open span in the source file. * * @public */ export interface CommentSourceSpan { /** Zero-based start offset in the source file. */ readonly start: number; /** One-past-the-end offset in the source file. */ readonly end: number; } /** * Canonical span type used throughout serialized comment analysis. * * @public */ export type CommentSpan = CommentSourceSpan; /** * Parsed target specifier attached to a comment tag. * * @public */ export interface ParsedCommentTargetSpecifier { /** Raw target text without the leading colon. */ readonly rawText: string; /** Whether the target parsed cleanly. */ readonly valid: boolean; /** Classified target kind used by completion and hover flows. */ readonly kind: "path" | "member" | "variant" | "ambiguous"; /** Full span covering the colon and target text. */ readonly fullSpan: CommentSourceSpan; /** Span covering only the colon prefix. */ readonly colonSpan: CommentSourceSpan; /** Span covering the target text after the colon. */ readonly span: CommentSourceSpan; /** Parsed path target when one could be resolved. */ readonly path: PathTarget | null; } /** * Parsed representation of a single FormSpec tag inside a comment block. * * @public */ export interface ParsedCommentTag { /** Raw tag name exactly as written in the source. */ readonly rawTagName: string; /** Normalized tag name used for registry lookup. */ readonly normalizedTagName: string; /** Whether the tag was recognized by the registry. */ readonly recognized: boolean; /** Full span covering the parsed tag. */ readonly fullSpan: CommentSourceSpan; /** Span covering the tag name token. */ readonly tagNameSpan: CommentSourceSpan; /** Span covering the payload after the tag name, if present. */ readonly payloadSpan: CommentSourceSpan | null; /** Span covering the target colon, if present. */ readonly colonSpan: CommentSourceSpan | null; /** Parsed target specifier, if present. */ readonly target: ParsedCommentTargetSpecifier | null; /** Span covering the argument text, if present. */ readonly argumentSpan: CommentSourceSpan | null; /** Raw argument text following the tag or target. */ readonly argumentText: string; } /** * Parsed representation of one doc comment block. * * @public */ export interface ParsedCommentBlock { /** Comment text with delimiters removed. */ readonly commentText: string; /** Absolute source offset where the comment block begins. */ readonly offset: number; /** Parsed tags discovered inside the comment. */ readonly tags: readonly ParsedCommentTag[]; } export interface ParseCommentSyntaxOptions { /** Absolute source offset for the parsed comment block. */ readonly offset?: number; /** Extension tag sources used to classify target specifiers. */ readonly extensions?: readonly ExtensionTagSource[]; } /** * Parse a doc comment block into tags and target/argument spans. * * @public */ export declare function parseCommentBlock(commentText: string, options?: ParseCommentSyntaxOptions): ParsedCommentBlock; /** * Parse a single tag form by synthesizing a comment block around it. * * @public */ export declare function parseTagSyntax(rawTagName: string, payloadText: string, options?: Omit): ParsedCommentTag; /** * Extracts summary text from a doc comment by taking the cleaned text that * appears before the first recognized tag marker. * * @public */ export declare function extractCommentSummaryText(commentText: string): string; /** * Extracts one or more TSDoc-style block-tag payloads, including continuation * lines until the next block tag begins. * * @public */ export declare function extractCommentBlockTagTexts(commentText: string, rawTagName: string): readonly string[]; /** * Extract the raw text corresponding to a serialized comment span. * * @public */ export declare function sliceCommentSpan(commentText: string, span: CommentSpan, options?: { readonly offset?: number; }): string; //# sourceMappingURL=comment-syntax.d.ts.map