diff options
author | albert-github <albert.tests@gmail.com> | 2020-09-15 10:30:40 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2020-09-15 10:30:40 (GMT) |
commit | a88b298bee89f001072c80e32e04dfd855d05c58 (patch) | |
tree | 0a1d06808ba9db730e2016bd5150116e298c38c4 /src/util.cpp | |
parent | 0fc06d657d596adcc289a5f228973ea268efd66d (diff) | |
download | Doxygen-a88b298bee89f001072c80e32e04dfd855d05c58.zip Doxygen-a88b298bee89f001072c80e32e04dfd855d05c58.tar.gz Doxygen-a88b298bee89f001072c80e32e04dfd855d05c58.tar.bz2 |
Incorrect duplicate code for Fortran fixed/free recognition
There were 2 routines to recognize whether Fortran code was Fixed of Free format code, though the version in `commentcnv.l` didn't take the settings of `EXTENSION_MAPPING` into account which might lead to incorrect recognition of the format, this has been corrected.
Diffstat (limited to 'src/util.cpp')
-rw-r--r-- | src/util.cpp | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/src/util.cpp b/src/util.cpp index 0581b5f..38cb5c9 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1828,7 +1828,7 @@ QCString removeRedundantWhiteSpace(const QCString &s) { if (nc != '=') // avoid splitting operator&= - { + { *dst++=' '; } } @@ -8474,3 +8474,56 @@ int usedTableLevels() } //------------------------------------------------------ +// simplified way to know if this is fixed form +bool recognizeFixedForm(const char* contents, FortranFormat format) +{ + int column=0; + bool skipLine=FALSE; + + if (format == FortranFormat_Fixed) return TRUE; + if (format == FortranFormat_Free) return FALSE; + + for(int i=0;;i++) { + column++; + + switch(contents[i]) { + case '\n': + column=0; + skipLine=FALSE; + break; + case ' ': + break; + case '\000': + return FALSE; + case '#': + skipLine=TRUE; + break; + case 'C': + case 'c': + case '*': + if (column==1) return TRUE; + if (skipLine) break; + return FALSE; + case '!': + if (column>1 && column<7) return FALSE; + skipLine=TRUE; + break; + default: + if (skipLine) break; + if (column>=7) return TRUE; + return FALSE; + } + } + return FALSE; +} + +FortranFormat convertFileNameFortranParserCode(QCString fn) +{ + QCString ext = getFileNameExtension(fn); + QCString parserName = Doxygen::parserManager->getParserName(ext.data()); + + if (parserName == "fortranfixed") return FortranFormat_Fixed; + else if (parserName == "fortranfree") return FortranFormat_Free; + + return FortranFormat_Unknown; +} |