[Python-checkins] r62524 - doctools/trunk/sphinx/directives.py

georg.brandl python-checkins at python.org
Sun Apr 27 17:24:21 CEST 2008


Author: georg.brandl
Date: Sun Apr 27 17:24:20 2008
New Revision: 62524

Log:
Allow commas in option desc parameters.


Modified:
   doctools/trunk/sphinx/directives.py

Modified: doctools/trunk/sphinx/directives.py
==============================================================================
--- doctools/trunk/sphinx/directives.py	(original)
+++ doctools/trunk/sphinx/directives.py	Sun Apr 27 17:24:20 2008
@@ -190,7 +190,7 @@
 
 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(
@@ -220,7 +220,7 @@
             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:
@@ -276,7 +276,8 @@
     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."""


More information about the Python-checkins mailing list