Issue 27 in f2py: recursively called parser does not preserve state of ignore_comments

2 views
Skip to first unread message

f2...@googlecode.com

unread,
Sep 6, 2010, 4:43:18 PM9/6/10
to f2py-...@googlegroups.com
Status: Accepted
Owner: omar.aw...@gmail.com
CC: pearu.peterson
Labels: Type-Defect Priority-Medium

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

Reply all
Reply to author
Forward
0 new messages