travellhyne / f2py

Automatically exported from code.google.com/p/f2py
Other
0 stars 0 forks source link

All what fparser may cause errors. #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Last year, I hacked your code a little so as to fparse a few of my *.F well
by myself. What I did is in fparsertestTakao1.tar.gz; just do
TEST_TAKAO.py, which is
------------------------
#!/usr/bin/env python
from api import parse
fff='./xxx.F'
tree = parse(fff,isfree=False,isstrict=False,ignore_comments=False)
print tree.content
------------------------
Anyway, I found it is not so easy for me to fix kinds of problems in fparser
--- then I stopped. But I really need to disentangle our spaghetti code.
So I want to start it again.

================================
fparserIssueTakao1.tar.gz:
   : contains all required files
    (Fortran file names are *.o under */obj.gfortran.fpp/) 
Usually we use fpp (fortran version cpp). But it makes parsing so
difficult;It is another step. So I now packed all files (fixed form) 
after preprocessed.
See fparserIssueTakao1.tar.gz; Note that Fortran file names
are *.o instead of *.F, because I used -E option in my makefile in gfortran.

Our full package is at http://github.com/tkotani/ecal.
But not useful to you, maybe.

best regards,
takao kotani

Original issue reported on code.google.com by TakaoKot...@gmail.com on 3 Mar 2010 at 1:02

Attachments:

GoogleCodeExporter commented 9 years ago
The problem is that your fixed format fortran code has lines starting with #.
Afaik, this is not allowed by Fortran standard. However, it seems 
reasonable to interpret such lines as comments (plus giving a warning).
I have applied the corresponding patch to fparser svn, now
the xxx.F is parsed successfully.

I think using .o extension for Fortran files is (highly) non-standard and
it does not make sense to support .o extensions by fparser. I would
reserve .o extensions for object files.
However, you can either rename such files or read these to
Python and feed their Fortran codes as strings to fparser.

Original comment by pearu.peterson on 3 Mar 2010 at 2:10

GoogleCodeExporter commented 9 years ago

Original comment by pearu.peterson on 7 Mar 2010 at 11:18