mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Do not highlight function pointers if unexpected tokens found
This commit is contained in:
parent
4e0053cceb
commit
65be2792a8
@ -40,9 +40,11 @@ c_funcptr_sig_re = re.compile(
|
||||
(\s+const)? $ # const specifier
|
||||
''', re.VERBOSE)
|
||||
c_funcptr_arg_sig_re = re.compile(
|
||||
r'''^\s*([^(,]+?) # return type
|
||||
r'''^\s*([^(,]+?) # return type
|
||||
\( ([^()]+) \) \s* # name in parentheses
|
||||
\( (.*) \) # arguments
|
||||
(\s+const)? # const specifier
|
||||
\s*(?=$|,) # end with comma or end of string
|
||||
''', re.VERBOSE)
|
||||
c_funcptr_name_re = re.compile(r'^\(\s*\*\s*(.*?)\s*\)$')
|
||||
|
||||
@ -154,6 +156,8 @@ class CObject(ObjectDescription):
|
||||
self._parse_type(param, m.group(1) + '(')
|
||||
param += nodes.emphasis(m.group(2), m.group(2))
|
||||
self._parse_type(param, ')(' + m.group(3) + ')')
|
||||
if m.group(4):
|
||||
param += addnodes.desc_addname(m.group(4), m.group(4))
|
||||
else:
|
||||
ctype, argname = arg.rsplit(' ', 1)
|
||||
self._parse_type(param, ctype)
|
||||
|
Loading…
Reference in New Issue
Block a user