Commits

Anonymous committed b536f6f

Allow commas in option desc parameters.

Comments (0)

Files changed (1)

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."""
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.