Commits

Anonymous committed b536f6f

Allow commas in option desc parameters.

  • Participants
  • Parent commits e9652a4

Comments (0)

Files changed (1)

File sphinx/directives.py

 
 c_sig_re = re.compile(
     r'''^([^(]*?)          # return type
-        (\w+)  \s*         # thing name
+        ([\w:]+)  \s*      # thing name (colon allowed for C++ class names)
         (?: \((.*)\) )? $  # optionally arguments
     ''', re.VERBOSE)
 c_funcptr_sig_re = re.compile(
             node += tnode
 
 def parse_c_signature(signode, sig, desctype):
-    """Transform a C-language signature into RST nodes."""
+    """Transform a C (or C++) signature into RST nodes."""
     # first try the function pointer signature regex, it's more specific
     m = c_funcptr_sig_re.match(sig)
     if m is None:
     return opname.strip()
 
 
-option_desc_re = re.compile(r'(/|-|--)([-_a-zA-Z0-9]+)(\s*.*?)(?=,|$)')
+option_desc_re = re.compile(
+    r'(/|-|--)([-_a-zA-Z0-9]+)(\s*.*?)(?=,\s+(?:/|-|--)|$)')
 
 def parse_option_desc(signode, sig):
     """Transform an option description into RST nodes."""