(raw: string)
| 938 | * @since 4.0.0 |
| 939 | */ |
| 940 | export function parseJSDoc(raw: string): Result<ParsedCoreJSDoc, JSDocParseError> { |
| 941 | const block = parseJSDocBlock(raw, [0, raw.length]) |
| 942 | if (block.internal) { |
| 943 | return { _tag: "Failure", error: { diagnostics: [diagnostic("internal", "Internal JSDoc blocks are ignored")] } } |
| 944 | } |
| 945 | if (block.diagnostics.length > 0 || block.parsed === undefined) { |
| 946 | return { _tag: "Failure", error: { diagnostics: block.diagnostics } } |
| 947 | } |
| 948 | return { _tag: "Success", value: block.parsed } |
| 949 | } |
| 950 | |
| 951 | function parseLooseJSDocBlock(raw: string, range: [number, number]): JSDocBlock { |
| 952 | const body = raw.replace(/^\/\*\*/, "").replace(/\*\/$/, "") |
no test coverage detected