MCPcopy Create free account
hub / github.com/effect-app/libs / parseCoreJSDoc

Function parseCoreJSDoc

repos/effect/packages/tools/jsdocs/src/Jsdocs.ts:961–1004  ·  view source on GitHub ↗
(lines: Array<string>, tags: Array<JSDocTag>)

Source from the content-addressed store, hash-verified

959 return { range, raw, lines: normalized, tags, diagnostics: [], internal }
960}
961
962function parseJSDocBlock(raw: string, range: [number, number]): JSDocBlock {
963 const base = parseLooseJSDocBlock(raw, range)
964 const { lines: normalized, tags, internal } = base
965 if (internal) {
966 return base
967 }
968 const result = parseCoreJSDoc(normalized, tags)
969 const block: JSDocBlock = {
970 ...base,
971 range,
972 raw,
973 lines: normalized,
974 tags,
975 diagnostics: result._tag === "Failure" ? Array.from(result.error.diagnostics) : [],
976 internal
977 }
978 return result._tag === "Success" ? { ...block, parsed: result.value } : block
979}
980
981function trimStructuralBlankLines(lines: Array<string>): Array<string> {
982 let start = 0
983 let end = lines.length
984 if (lines[start]?.trim() === "") {
985 start++
986 }
987 if (end > start && lines[end - 1]?.trim() === "") {
988 end--
989 }
990 return lines.slice(start, end)
991}
992
993function parseTags(lines: Array<string>): Array<JSDocTag> {
994 const tags: Array<JSDocTag> = []
995 let current: JSDocTag | undefined
996 let inFence = false
997
998 for (let index = 0; index < lines.length; index++) {
999 const trimmed = lines[index].trim()
1000 if (trimmed.startsWith("```")) {
1001 inFence = !inFence
1002 current = undefined
1003 continue
1004 }
1005 if (inFence) {
1006 continue
1007 }

Callers 1

parseJSDocBlockFunction · 0.85

Calls 5

diagnosticFunction · 0.85
parseDescriptionContentFunction · 0.85
uniqueDiagnosticsFunction · 0.85
pushMethod · 0.80
atMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…