Skip to content

Commit

Permalink
Added import keyword to FORTRAN code highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
hansec committed May 5, 2014
1 parent e9b40bf commit 5586977
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/fortrancode.l
Expand Up @@ -716,6 +716,7 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I
%x DocBlock
%x Use
%x UseOnly
%x Import
%x TypeDecl
%x Declaration
%x DeclContLine
Expand Down Expand Up @@ -791,19 +792,32 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I
yy_push_state(YY_START);
BEGIN(UseOnly);
}
<UseOnly>{BS},{BS} { codifyLines(yytext); }
<UseOnly>{BS}&{BS}"\n" { codifyLines(yytext); YY_FTN_RESET}
<UseOnly,Import>{BS},{BS} { codifyLines(yytext); }
<UseOnly,Import>{BS}&{BS}"\n" { codifyLines(yytext); YY_FTN_RESET}
<UseOnly>{ID} {
g_insideBody=TRUE;
generateLink(*g_code, yytext);
g_insideBody=FALSE;
useEntry->onlyNames.append(yytext);
}
<Use,UseOnly>"\n" {
<Use,UseOnly,Import>"\n" {
unput(*yytext);
yy_pop_state();YY_FTN_RESET
}

<Start>"import"{BS_} {
startFontClass("keywordflow");
codifyLines(yytext);
endFontClass();
yy_push_state(YY_START);
BEGIN(Import);
}
<Import>{ID} {
QCString tmp = yytext;
tmp = tmp.lower();
g_insideBody=TRUE;
generateLink(*g_code, yytext);
g_insideBody=FALSE;
}
/*-------- fortran module -----------------------------------------*/
<Start>("block"{BS}"data"|"program"|"module"|"type"|"interface")/{BS_}|({COMMA}{ACCESS_SPEC})|\n { //
startScope();
Expand Down

0 comments on commit 5586977

Please sign in to comment.