Open albertziegenhagel opened 5 months ago
Thanks @albertziegenhagel I will look into it.
I think I have located the problem, however it interferes with the spaghetti code for parsing Doxygen-like and FORD-like docstrings. I might have to rewrite those 2 parsers first, before I fix this. I
Describe the bug Given a fixed-form Fortran file that has a comment line which includes a semicolon, all text after the semicolon in the comment line is parsed as regular code. This can confuse the parser if the comment includes text that makes up Fortran keywords.
To Reproduce Given the following code in a file called
invalid_comment.f
:Then, calling
fortls --debug_filepath invalid_comment.f --debug_parser
giveswhich shows that the
do
in the first comment line is parsed as a do-statement. This can lead to many follow up errors, e.g. in the code above we will get an "Invalid parent for "SUBROUTINE" declaration" diagnostic being generated in line 2, since for the parser it seems that the subroutine is defined within a "do" loop.Expected behavior Comments should never be parsed as code.
Screenshots & Animations
Setup information (please complete the following information):