--- src/.svn/text-base/fortranscanner.l.svn-base	2011-09-25 18:23:38.907912000 +0200
+++ src/fortranscanner.l	2011-10-19 18:49:00.525511500 +0200
@@ -180,6 +180,7 @@
 static InterfaceType     ifType = IF_NONE;
 
 static char              stringStartSymbol; // single or double quote
+static int function_line = 0;
 
 //! Accumulated modifiers of current statement, eg variable declaration.
 static SymbolModifiers currentModifiers;
@@ -303,6 +304,7 @@
  /*-----------------------------------------------------------------------------------*/
 
 <*>^.*\n                                { // prepass: look for line continuations
+                                            function_line = 0;
 
                                           //fprintf(stderr, "---%s", yytext);
 
@@ -980,11 +982,15 @@
 					   BEGIN(SubprogBody);				           
 }
 <SubprogBody>result{BS}\({BS}{ID}      {  
+                                           // first check if we are on the function line
+                                           if (function_line)
+                                           {
                                            result= yytext;
                                            result= result.right(result.length()-result.find("(")-1);
                                            result= result.stripWhiteSpace();
  					   modifiers[current_root->parent()][current_root->name.lower()].returnName = result;
                                            //cout << "=====> got result " <<  result << endl;
+                                           }
  				       } 
 
  /*---- documentation comments --------------------------------------------------------------------*/
@@ -1900,6 +1906,7 @@
 static void addSubprogram(const char *text)
 {
   //fprintf(stderr,"1=========> got subprog, type: %s\n",text); 
+  if (QCString(text).lower() == "function") function_line = 1;
   subrCurrent.prepend(current);
   current->section = Entry::FUNCTION_SEC ;
   QCString subtype = text; subtype=subtype.lower().stripWhiteSpace();
