diff options
author | Pearu Peterson <pearu.peterson@gmail.com> | 2006-06-30 13:36:13 +0000 |
---|---|---|
committer | Pearu Peterson <pearu.peterson@gmail.com> | 2006-06-30 13:36:13 +0000 |
commit | ec1662fb0182a87ebf39ec476109becfc7a8cdb1 (patch) | |
tree | 8fccdddd721e148af03e0f7849920bcd6fc560f9 /numpy/f2py/lib/readfortran.py | |
parent | 906855403e7b9853222af1c715202c86b226b71e (diff) | |
download | numpy-ec1662fb0182a87ebf39ec476109becfc7a8cdb1.tar.gz |
Writting parser unittests, fixed bugs.
Diffstat (limited to 'numpy/f2py/lib/readfortran.py')
-rw-r--r-- | numpy/f2py/lib/readfortran.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/numpy/f2py/lib/readfortran.py b/numpy/f2py/lib/readfortran.py index b275d220f..add45e71c 100644 --- a/numpy/f2py/lib/readfortran.py +++ b/numpy/f2py/lib/readfortran.py @@ -51,7 +51,7 @@ class Line: """ Holds a Fortran source line. """ - f2py_strmap_findall = re.compile(r'( _F2PY_STRING_CONSTANT_\d+_ |\(F2PY_EXPR_TUPLE_\d+\))').findall + f2py_strmap_findall = re.compile(r'(_F2PY_STRING_CONSTANT_\d+_|F2PY_EXPR_TUPLE_\d+)').findall def __init__(self, line, linenospan, label, reader): self.line = line.strip() @@ -61,8 +61,12 @@ class Line: self.strline = None self.is_f2py_directive = linenospan[0] in reader.f2py_comment_lines + def has_map(self): + return not not (hasattr(self,'strlinemap') and self.strlinemap) + def apply_map(self, line): - if not hasattr(self,'strlinemap'): return line + if not hasattr(self,'strlinemap') or not self.strlinemap: + return line findall = self.f2py_strmap_findall str_map = self.strlinemap keys = findall(line) |