mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Strip parentheses for C function pointer type names.
This commit is contained in:
parent
61849627d9
commit
1e69f308ff
@ -191,6 +191,7 @@ c_funcptr_sig_re = re.compile(
|
|||||||
(\( [^()]+ \)) \s* # name in parentheses
|
(\( [^()]+ \)) \s* # name in parentheses
|
||||||
\( (.*) \) $ # arguments
|
\( (.*) \) $ # arguments
|
||||||
''', re.VERBOSE)
|
''', re.VERBOSE)
|
||||||
|
c_funcptr_name_re = re.compile(r'^\(\s*\*\s*(.*?)\s*\)$')
|
||||||
|
|
||||||
# RE to split at word boundaries
|
# RE to split at word boundaries
|
||||||
wsplit_re = re.compile(r'(\W+)')
|
wsplit_re = re.compile(r'(\W+)')
|
||||||
@ -224,6 +225,10 @@ def parse_c_signature(signode, sig, desctype):
|
|||||||
signode += addnodes.desc_type("", "")
|
signode += addnodes.desc_type("", "")
|
||||||
parse_c_type(signode[-1], rettype)
|
parse_c_type(signode[-1], rettype)
|
||||||
signode += addnodes.desc_name(name, name)
|
signode += addnodes.desc_name(name, name)
|
||||||
|
# clean up parentheses from canonical name
|
||||||
|
m = c_funcptr_name_re.match(name)
|
||||||
|
if m:
|
||||||
|
name = m.group(1)
|
||||||
if not arglist:
|
if not arglist:
|
||||||
if desctype == 'cfunction':
|
if desctype == 'cfunction':
|
||||||
# for functions, add an empty parameter list
|
# for functions, add an empty parameter list
|
||||||
|
Loading…
Reference in New Issue
Block a user