New issue 27 by omar.aw...@gmail.com: recursively called parser does not
preserve state of ignore_comments
http://code.google.com/p/f2py/issues/detail?id=27
Hi Pearu,
When the analyse() function of the Use statement is called it will try to
find the file of the module and call the parser to parse and analyse this
module. However, i noticed that the ignore_comments parameter to the
constructor of FortranParser is not set. So if the user is parsing with
ignore_comments=False, then this is not carried through to the parser
instances called within the cascade of analyse() calls.
Here's my proposed fix:
diff -r ec5eb01a4e3e fparser/statements.py
--- a/fparser/statements.py Fri Sep 03 20:20:51 2010 +0300
+++ b/fparser/statements.py Mon Sep 06 22:36:52 2010 +0200
@@ -913,7 +913,7 @@
from parsefortran import FortranParser
self.info('looking module information from %r' % (fn))
reader = FortranFileReader(fn,
include_dirs=self.reader.include_dirs, source_only=self.reader.source_only)
- parser = FortranParser(reader)
+ parser =
FortranParser(reader,ignore_comments=self.top.parent.ignore_comments)
parser.parse()
parser.block.a.module.update(modules)
parser.analyze()
best,
omar