fortran-language-server: preprocessor conditional code causing problems
The following is a valid code excerpt from a project:
#ifndef USE_PYQT
select case(message%value1)
#else
select case(message)
#endif
However, it seems fortls is simply ignoring the preprocessor directives and treating the second select case as a nested select, which is causing parsing problems/lot of unexpected end of scope diagnostic errors.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 19 (13 by maintainers)
Commits related to this issue
- Add initial implementation of simple preprocessor, ref #78 — committed to hansec/fortran-language-server by hansec 5 years ago
- Add initial implementation of simple preprocessor, ref #78 — committed to hansec/fortran-language-server by hansec 5 years ago
- Improve preprocessing to handle more types of conditional statements and basic variable substitution, ref #78 — committed to hansec/fortran-language-server by hansec 5 years ago
- Improve preprocessing to handle more types of conditional statements and basic variable substitution, ref #78 — committed to hansec/fortran-language-server by hansec 5 years ago
- Report diagnostics for excess "END" statements instead of causing parser failure, ref #78 - Include first declaration of object with multiple definitions in diagnostic "relatedInformation" — committed to hansec/fortran-language-server by hansec 5 years ago
- Improve preprocessing to handle more types of conditional statements and macro substitution, ref #78 - Preprocessor definition in .fortls is now done with a dictionary, see README for more informatio... — committed to hansec/fortran-language-server by hansec 5 years ago
@emanspeaks Go ahead and upgrade to 1.2.0, it is the most up to date. Also, note that I changed the way preprocessor variables are defined in the
.fortlsfile to a dictionary to allow setting values not just defined/undefined. See the README for more info.