Commit d5d946a6 authored by Dimitri van Heesch's avatar Dimitri van Heesch
Browse files

Merge pull request #166 from hansec/fortran_import

Add import keyword to FORTRAN code highlighting
parents e9b40bf0 d8221cb7
Loading
Loading
Loading
Loading
+16 −4
Original line number Original line Diff line number Diff line
@@ -716,6 +716,7 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I
%x DocBlock
%x DocBlock
%x Use
%x Use
%x UseOnly
%x UseOnly
%x Import
%x TypeDecl
%x TypeDecl
%x Declaration
%x Declaration
%x DeclContLine
%x DeclContLine
@@ -791,19 +792,30 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I
                                          yy_push_state(YY_START);
                                          yy_push_state(YY_START);
					  BEGIN(UseOnly);     
					  BEGIN(UseOnly);     
                                        }           
                                        }           
<UseOnly>{BS},{BS}                      { codifyLines(yytext); }
<UseOnly,Import>{BS},{BS}               { codifyLines(yytext); }
<UseOnly>{BS}&{BS}"\n"                  { codifyLines(yytext); YY_FTN_RESET}
<UseOnly,Import>{BS}&{BS}"\n"           { codifyLines(yytext); YY_FTN_RESET}
<UseOnly>{ID}                           {
<UseOnly>{ID}                           {
                                          g_insideBody=TRUE;
                                          g_insideBody=TRUE;
                                          generateLink(*g_code, yytext);
                                          generateLink(*g_code, yytext);
                                          g_insideBody=FALSE;
                                          g_insideBody=FALSE;
                                          useEntry->onlyNames.append(yytext);
                                          useEntry->onlyNames.append(yytext);
                                        }
                                        }
<Use,UseOnly>"\n"                       {
<Use,UseOnly,Import>"\n"                {
                                          unput(*yytext);
                                          unput(*yytext);
                                          yy_pop_state();YY_FTN_RESET
                                          yy_pop_state();YY_FTN_RESET
                                        }
                                        }
       
<Start>"import"{BS_}                    {
                                          startFontClass("keywordtype");
                                          codifyLines(yytext);
                                          endFontClass();
                                          yy_push_state(YY_START);
                                          BEGIN(Import);
                                        }
<Import>{ID}                            {
                                          g_insideBody=TRUE;
                                          generateLink(*g_code, yytext);
                                          g_insideBody=FALSE;
                                        }
 /*-------- fortran module  -----------------------------------------*/
 /*-------- fortran module  -----------------------------------------*/
<Start>("block"{BS}"data"|"program"|"module"|"type"|"interface")/{BS_}|({COMMA}{ACCESS_SPEC})|\n {  //
<Start>("block"{BS}"data"|"program"|"module"|"type"|"interface")/{BS_}|({COMMA}{ACCESS_SPEC})|\n {  //
					  startScope();
					  startScope();