Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recursively called parser does not preserve state of ignore_comments #27

Open
GoogleCodeExporter opened this issue Aug 5, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

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

Original issue reported on code.google.com by [email protected] on 6 Sep 2010 at 8:42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant