pyfcstm.utils.doc
Provides functionality for formatting multiline comments in code.
This module contains utilities for cleaning and formatting multiline comments that have been parsed from source code, particularly those extracted by ANTLR4. It handles removing comment markers, aligning indentation, and cleaning up whitespace to produce readable documentation text.
format_multiline_comment
- pyfcstm.utils.doc.format_multiline_comment(raw_doc)[source]
Format multiline comments parsed by ANTLR4 by removing comment markers and aligning indentation.
This function takes a raw multiline comment (including /* */ markers) and processes it to produce clean, properly formatted documentation text. It removes comment delimiters, trims unnecessary whitespace, and normalizes indentation.
- Parameters:
raw_doc (str) – Raw comment text including /* */ markers
- Returns:
Formatted comment text with markers removed and proper indentation
- Return type:
str
Example:
>>> raw = """/* This is a ... * multiline comment ... */""" >>> format_multiline_comment(raw) 'This is a\nmultiline comment'