-
Notifications
You must be signed in to change notification settings - Fork 131
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
Using ford with an existing project #475
Comments
Okay so I managed to get ford running on a decent chunk of the codebase. It seems like it has trouble parsing '$' especially when it is in the name of a function, subroutine, derived type, etc. Is this a common problem and is there a way around it? |
Hi @runburg , thanks for the bug report. If it's the latter, that's easily dealt with -- see the preprocessing options. If it's a compiler extension, on the other hand, we'd probably have to look at handling it in the FORD parser. Maybe through an option like "extra_identifier_characters" or something. A third option is to replace |
Hmm...I'm on Windows using Intel® Fortran Compiler Classic 2021.8.0 with Fortran Preprocessor 21.0-1007 right out of the box (from the intel oneAPI toolset). So I don't think I'm using any extensions or custom preprocessor but maybe there is something going on behind the scenes that I don't know about (I am still new to Fortran and this project). The use of FWIW, it seems that intel at least supports using Is there any other information I can provide to try and get a clearer answer on what's happening? Thanks for your help! |
The bit in green means it's a language extension, but it looks like it's enabled by default for Intel. A quick survey of other compiler manuals shows that gfortran and PGI accept it with a flag, IBM doesn't accept it at all, NAG does, Cray does but not at the start of names. I'll have a look at adding it as an option to FORD, but I would suggest it's a good idea to try and replace it with another character. |
Oh whoops I see now. Thanks for the clarification. Long-term, I agree that I should change things. But it is used thousands of times in this project and it's not on the top of my to do list right now. In the meantime, FORD is working great otherwise! |
Hello @runburg, I am in a similar situation to yours. I also get numerous Unexpected SUBROUTINE and Unexpected variable errors when parsing the source code. Did you find a solution to this problem? |
@jmbcastro Are you able to post a short snippet that reproduces the issue? Or, if your source code is public, I can have a look myself. |
Hi @ZedThree, thank you for your response. Unfortunately the code is not public. I was digging around and found out that the errors were due to situations like these in several points of the source code: First
Those subroutines are elsewhere coded in C. FORD does not seem to like Interfaces with subroutines inside. Second
FORD cannot understand that CHARACTER(LEN=250) and INTEGER refer to the type of the output value. Third
This is in F77. FORD does not like the inline comments explaining what the arguments are. Fourth
This is some poorly formatted F77 code, where we have tabs before the return and end statements. It seems FORD cannot handle that. I hope this helps you to make FORD more robust. Cheers |
Thanks for the examples @jmbcastro
|
Hi @ZedThree,
Cheers |
I'll have a look at fixing 2 and 3 |
I have inherited a very large fortran project and for my own sanity I would like to have some good documentation. I think ford is the right answer.
I am trying to slowly migrate this project over to but I'm to get some advice for how to do this. If I try and run ford on the whole codebase, I get a bunch of parsing errors
'NoneType' object is not subscriptable
.I also get
Unexpected SUBROUTINE
messages which end up throwing aNotImplementedError()
which results inand
Unexpected variable
messages which result in the same as above.If I throw out only focus on the source files that do not result in these parsing issues, ford makes it to
Correlating information from different parts of your project...
and then throws the errorThe codebase is written almost entirely in modern fortran. But are there certain features that ford will get hung up on or that commonly cause these kind of problems.
Thanks!
The text was updated successfully, but these errors were encountered: