KlynDocComment
classin packageklyn.code.klyn
public class KlynDocComment extends Object
└ KlynDocComment

Structured parser and text extractor for KlynDoc documentation comments and Klyn declaration headers.

Provides line-comment stripping outside string literals, top-level comma splitting across nested generic/callable brackets, relative-indentation-preserving doc comment cleaning, summary sentence extraction (aware of backtick code spans), and @param, @return, @throws, and @example tag extraction.

import klyn.code.klyn

raw = " *\n * Computes the sum of `a` and `b`.\n *\n * @param a First operand.\n * @return The sum."
cleaned = KlynDocComment.cleanDocBlock(raw)
assert KlynDocComment.firstSentence(cleaned) == "Computes the sum of `a` and `b`."
assert KlynDocComment.singleTagValue(cleaned, "@return") == "The sum."
Inherited Properties
propertyInherited Properties from Object: type
Methods
Modifier and Type Member Description
public static cleanDocBlock
cleanDocBlock(value as String) as String
Cleans an entire multi-line documentation block, preserving relative indentation inside fenced code blocks.
public static cleanDocLine
cleanDocLine(value as String) as String
Removes leading documentation comment delimiters (*) from a single line while preserving relative indentation for embedded code examples.
public static countLeadingSpaces
countLeadingSpaces(value as String) as Int
Counts the number of leading ASCII space characters (' ') at the start of value.
public static exampleText
exampleText(text as String) as String
Returns the example section of a KlynDoc comment (either explicit @example or trailing fenced code block after @ tags).
public static firstSentence
firstSentence(value as String) as String
Extracts the first summary sentence from a cleaned documentation comment.
public static implicitExampleText
implicitExampleText(text as String) as String
Extracts trailing fenced code blocks ( ) placed after @ tags when no explicit @example` tag is used.
public static mainDescription
mainDescription(text as String) as String
Extracts the main description body prior to the first @ tag line.
public static paramDescription
paramDescription(value as String) as String
Extracts the parameter description from a @param tag value.
public static paramName
paramName(value as String) as String
Extracts the parameter identifier from a @param tag value (stripping surrounding backticks).
public static readIdentifier
readIdentifier(value as String) as String
Reads the leading identifier or qualified token from value up to the first whitespace or delimiter character (:, (, ), ,, =, <, >, [, ]).
public static singleTagValue
singleTagValue(text as String, tag as String) as String
Extracts the first value of a single-occurrence tag (such as @return).
public static splitTopLevelCommaSeparated
splitTopLevelCommaSeparated(value as String) as ArrayList<String>
Splits a comma-separated list at top level only, ignoring commas nested inside <...>, (...), [...], or {...}.
public static stripLineComment
stripLineComment(value as String) as String
Strips a trailing # line comment from value while ignoring # characters inside string, character, or backtick literals.
public static tagBlockValue
tagBlockValue(text as String, tag as String) as String
Extracts a multi-line block tag (such as @example), preserving fenced code blocks and indentation.
public static tagValues
tagValues(text as String, tag as String) as ArrayList<String>
Extracts all values for a repeatable KlynDoc tag (such as @param or @throws), joining wrapped continuation lines.
Inherited Methods
methodInherited Methods from Object: deepCopy, fromJson, hash, toDict, toJson, toMap, toString, toXml