[Scipy-svn] r4515 - trunk/scipy/sandbox/mkufunc/mkufunc

scipy-svn@scip... scipy-svn@scip...
Tue Jul 1 09:20:08 CDT 2008


Author: ilan
Date: 2008-07-01 09:20:07 -0500 (Tue, 01 Jul 2008)
New Revision: 4515

Modified:
   trunk/scipy/sandbox/mkufunc/mkufunc/api.py
Log:
Made regular expression readable

Modified: trunk/scipy/sandbox/mkufunc/mkufunc/api.py
===================================================================
--- trunk/scipy/sandbox/mkufunc/mkufunc/api.py	2008-07-01 13:33:19 UTC (rev 4514)
+++ trunk/scipy/sandbox/mkufunc/mkufunc/api.py	2008-07-01 14:20:07 UTC (rev 4515)
@@ -104,9 +104,17 @@
         self.cname = self._prefix + 'pypy_g_' + f.__name__
 
     def cfunc(self):
-        p = re.compile(r'^\w+[*\s\w]+' + self.cname +
-                       r'\s*\([^)]*\)\s*\{.*?[\n\r]\}[\n\r]',
-                       re.DOTALL | re.MULTILINE | re.VERBOSE)
+        p = re.compile(
+            r'''
+            ^\w+                 # return type of function
+            [\s]+                # whitespace
+            %s                   # function name
+            \s*                  # possibly whitespace
+            \([^)]*\)            # argument types
+            \s*                  # possibly whitespace
+            \{.*?[\n\r]\}[\n\r]  # function body ending with } in single line
+            ''' % self.cname,
+            re.DOTALL | re.MULTILINE | re.VERBOSE)
         
         found = p.findall(self._allCsrc)
         assert len(found) == 1



More information about the Scipy-svn mailing list