CParser
parse_c_comments(comment:str)
Parse a Doxygen-style C comment block into structured documentation fields. Supported tags: @brief, @param, @return, @note, @warning
Parameters:
comment
(str): Raw comment string from a C file, including Doxygen tags.
Returns:
'warnings'
: strExamples:
>>> comment = '''
... /**
... * @brief Adds two integers.
... * @param a First number
... * @param b Second number
... * @return int Sum of a and b
... */
... '''
>>> parsed = parse_c_comments(comment)
>>> print(parsed['brief'])
Adds two integers.
Labels:
src_PyThon_Docy_CParser_parse_c_comments
extract_c_functions(file_path:str)
Extract C functions and their associated Doxygen comments from a C file. Only functions with /** ... */ style comments immediately preceding them are extracted.
Parameters:
file_path
(str): Path to the C source file (.c or .h).
Returns:
'doc'
: dict # Parsed output from parse_c_comments()Examples:
>>> funcs = extract_c_functions("example.c")
>>> print(funcs[0]['name'])
my_function
Labels:
src_PyThon_Docy_CParser_extract_c_functions
generate_c_function_html(func:dict)
Generate HTML documentation for a single C function.
Parameters:
func
(dict): A function dictionary returned from `extract_c_functions`, with keys:
Returns:
str
: HTML string describing the function in a structured format.Examples:
>>> html = generate_c_function_html(funcs[0])
>>> print(html)
Labels:
src_PyThon_Docy_CParser_generate_c_function_html