Skip to content

Commit

Permalink
javadoc: add support for tparam, retval, throws and exception
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanlachnit committed Nov 13, 2023
1 parent cfdd547 commit 8701094
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/hawkmoth/util/doccompat.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,21 @@ def javadoc(comment):
# @param[direction]
comment = re.sub(r"(?m)^([ \t]*)@param\[([^]]*)\]([ \t]+)([a-zA-Z0-9_]+|\.\.\.)([ \t]+)",
"\n\\1:param\\3\\4: *(\\2)* \\5", comment)
# @tparam
comment = re.sub(r"(?m)^([ \t]*)@tparam([ \t]+)([a-zA-Z0-9_]+|\.\.\.)([ \t]+)",
"\n\\1:tparam\\2\\3:\\4", comment)
# @return
comment = re.sub(r"(?m)^([ \t]*)@returns?([ \t]+|$)",
"\n\\1:return:\\2", comment)
# @retval
comment = re.sub(r"(?m)^([ \t]*)@retvals?([ \t]+)([a-zA-Z0-9_]+|\.\.\.)([ \t]+)",
"\n\\1:retval\\2\\3:\\4", comment)
# @throw
comment = re.sub(r"(?m)^([ \t]*)@thows?([ \t]+)([a-zA-Z0-9_]+|\.\.\.)([ \t]+)",
"\n\\1:throw\\2\\3:\\4", comment)
# @exception
comment = re.sub(r"(?m)^([ \t]*)@exception([ \t]+)([a-zA-Z0-9_]+|\.\.\.)([ \t]+)",
"\n\\1:throw\\2\\3:\\4", comment)
# @code/@endcode blocks. Works if the code is indented.
comment = re.sub(r"(?m)^([ \t]*)@code([ \t]+|$)",
"\n::\n", comment)
Expand Down

0 comments on commit 8701094

Please sign in to comment.