(raw: string)
| 960 | * @since 4.0.0 |
| 961 | */ |
| 962 | export function parseJSDoc(raw: string): Result<ParsedCoreJSDoc, JSDocParseError> { |
| 963 | const block = parseJSDocBlock(raw, [0, raw.length]) |
| 964 | if (block.internal) { |
| 965 | return { _tag: "Failure", error: { diagnostics: [diagnostic("internal", "Internal JSDoc blocks are ignored")] } } |
| 966 | } |
| 967 | if (block.diagnostics.length > 0 || block.parsed === undefined) { |
| 968 | return { _tag: "Failure", error: { diagnostics: block.diagnostics } } |
| 969 | } |
| 970 | return { _tag: "Success", value: block.parsed } |
| 971 | } |
| 972 | |
| 973 | function parseLooseJSDocBlock(raw: string, range: [number, number]): JSDocBlock { |
| 974 | const body = raw.replace(/^\/\*\*/, "").replace(/\*\/$/, "") |
no test coverage detected