|
85 | 85 |
|
86 | 86 | # Regular expressions for start and end of declarations in mpi.h. These are |
87 | 87 | # used to get the declaration strings out for parsing with formal_re below. |
88 | | -begin_decl_re = re.compile("(" + "|".join(rtypes) + ")\s+(MPI_\w+)\s*\(") |
| 88 | +begin_decl_re = re.compile(r"(" + "|".join(rtypes) + r")\s+(MPI_\w+)\s*\(") |
89 | 89 | exclude_re = re.compile("|".join(exclude_strings)) |
90 | | -end_decl_re = re.compile("\).*\;") |
| 90 | +end_decl_re = re.compile(r"\).*\;") |
91 | 91 |
|
92 | 92 | # Regular Expression for splitting up args. Matching against this |
93 | 93 | # returns three groups: type info, arg name, and array info |
94 | 94 | formal_re = re.compile( |
95 | | - "\s*(" + # Start type |
96 | | - "(?:const)?\s*" + # Initial const |
97 | | - "\w+" # Type name (note: doesn't handle 'long long', etc. right now) |
98 | | - ")\s*(" + # End type, begin pointers |
99 | | - "(?:\s*\*(?:\s*const)?)*" + # Look for 0 or more pointers with optional 'const' |
100 | | - ")\s*" # End pointers |
101 | | - "(?:(\w+)\s*)?" + # Argument name. Optional. |
102 | | - "(\[.*\])?\s*$" # Array type. Also optional. Works for multidimensions b/c it's greedy. |
| 95 | + r"\s*(" + # Start type |
| 96 | + r"(?:const)?\s*" + # Initial const |
| 97 | + r"\w+" # Type name (note: doesn't handle 'long long', etc. right now) |
| 98 | + r")\s*(" + # End type, begin pointers |
| 99 | + r"(?:\s*\*(?:\s*const)?)*" + # Look for 0 or more pointers with optional 'const' |
| 100 | + r")\s*" # End pointers |
| 101 | + r"(?:(\w+)\s*)?" + # Argument name. Optional. |
| 102 | + r"(\[.*\])?\s*$" # Array type. Also optional. Works for multidimensions b/c it's greedy. |
103 | 103 | ) |
104 | 104 |
|
105 | 105 | # Fortran wrapper suffix |
@@ -724,12 +724,12 @@ def cFormal(self): |
724 | 724 | def castType(self): |
725 | 725 | arr = self.array or '' |
726 | 726 | pointers = self.pointers or '' |
727 | | - if re.search('\[\s*\]', arr): |
| 727 | + if re.search(r'\[\s*\]', arr): |
728 | 728 | if arr.count('[') > 1: |
729 | 729 | pointers += '(*)' # need extra parens for, e.g., int[][3] -> int(*)[3] |
730 | 730 | else: |
731 | 731 | pointers += '*' # justa single array; can pass pointer. |
732 | | - arr = re.sub('\[\s*\]', '', arr) |
| 732 | + arr = re.sub(r'\[\s*\]', '', arr) |
733 | 733 | return "%s%s%s" % (self.type, pointers, arr) |
734 | 734 |
|
735 | 735 | def __str__(self): |
|
0 commit comments