diff options
author | albert-github <albert.tests@gmail.com> | 2018-02-15 14:25:15 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2018-02-15 14:25:15 (GMT) |
commit | 4013e52ba0f87eb12f8a1c8cb3b2714c0d519a81 (patch) | |
tree | 2c5faa323f02a26208c70ee794a4e906d8156e7f /src/fortrancode.l | |
parent | b6f01ff09b17e5c2288f2418ef0a8f074456c357 (diff) | |
download | Doxygen-4013e52ba0f87eb12f8a1c8cb3b2714c0d519a81.zip Doxygen-4013e52ba0f87eb12f8a1c8cb3b2714c0d519a81.tar.gz Doxygen-4013e52ba0f87eb12f8a1c8cb3b2714c0d519a81.tar.bz2 |
Fortran improvements (2)
- handling of type / class statement especially in declarations in source browser and scanner
- color code import statement in source browser
Diffstat (limited to 'src/fortrancode.l')
-rw-r--r-- | src/fortrancode.l | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/src/fortrancode.l b/src/fortrancode.l index 501b492..1ad184f 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -159,6 +159,9 @@ static char stringStartSymbol; // single or double quote // declared from referenced names static int bracketCount = 0; +// signal when in type / class /procedure declaration +static int inTypeDecl = 0; + static bool g_endComment; static void endFontClass() @@ -813,7 +816,8 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I unput(*yytext); yy_pop_state();YY_FTN_RESET } -<Start>"import"{BS_} { +<*>"import"{BS}/"\n" | +<*>"import"{BS_} { startFontClass("keywordtype"); codifyLines(yytext); endFontClass(); @@ -825,6 +829,11 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I generateLink(*g_code, yytext); g_insideBody=FALSE; } +<Import>("ONLY"|"NONE"|"ALL") { + startFontClass("keywordtype"); + codifyLines(yytext); + endFontClass(); + } /*-------- fortran module -----------------------------------------*/ <Start>("block"{BS}"data"|"program"|"module"|"interface")/{BS_}|({COMMA}{ACCESS_SPEC})|\n { // startScope(); @@ -836,14 +845,14 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I if (!qstricmp(yytext,"module")) currentModule="module"; } <Start>("type")/{BS_}|({COMMA}({ACCESS_SPEC}|ABSTRACT|EXTENDS))|\n { // - startScope(); - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); + startScope(); + startFontClass("keyword"); + codifyLines(yytext); + endFontClass(); yy_push_state(YY_START); - BEGIN(ClassName); - currentClass="class"; - } + BEGIN(ClassName); + currentClass="class"; + } <ClassName>{ID} { if (currentModule == "module") { @@ -876,7 +885,7 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I codifyLines(yytext); endFontClass(); } -<Start>({PREFIX}{BS_})?{SUBPROG}{BS_} { // Fortran subroutine or function found +<Start>({PREFIX}{BS_})?{SUBPROG}{BS_} { // Fortran subroutine or function found startFontClass("keyword"); codifyLines(yytext); endFontClass(); @@ -923,6 +932,9 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I } /*-------- variable declaration ----------------------------------*/ <Start>{TYPE_SPEC}/[,:( ] { + QCString typ = yytext; + typ = typ.lower(); + if (typ == "type" || typ == "class" || typ == "procedure") inTypeDecl = 1; yy_push_state(YY_START); BEGIN(Declaration); startFontClass("keywordtype"); @@ -946,7 +958,7 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I g_code->codify(yytext); endFontClass(); } - else if (g_currentMemberDef && ((g_currentMemberDef->isFunction() && (g_currentMemberDef->typeString() != QCString("subroutine"))) || + else if (g_currentMemberDef && ((g_currentMemberDef->isFunction() && (g_currentMemberDef->typeString() != QCString("subroutine") || inTypeDecl)) || g_currentMemberDef->isVariable())) { generateLink(*g_code, yytext); @@ -956,22 +968,23 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I g_code->codify(yytext); addLocalVar(yytext); } - } -<Declaration>{BS}("=>"|"="){BS} { // Procedure binding - BEGIN(DeclarationBinding); - g_code->codify(yytext); - } -<DeclarationBinding>{ID} { // Type bound procedure link + } +<Declaration>{BS}("=>"|"="){BS} { // Procedure binding + BEGIN(DeclarationBinding); + g_code->codify(yytext); + } +<DeclarationBinding>{ID} { // Type bound procedure link generateLink(*g_code, yytext); yy_pop_state(); - } -<Declaration>[(] { // start of array specification + } +<Declaration>[(] { // start of array or type / class specification bracketCount++; g_code->codify(yytext); } <Declaration>[)] { // end array specification bracketCount--; + if (!bracketCount) inTypeDecl = 0; g_code->codify(yytext); } |