changeset 1019:7a632c749c67

[project @ 1995-01-09 18:58:33 by jwe]
author jwe
date Mon, 09 Jan 1995 18:58:33 +0000
parents 9a64a46f2224
children 5dbaaa0b3d46
files src/lex.l
diffstat 1 files changed, 40 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/src/lex.l	Sat Jan 07 19:29:47 1995 +0000
+++ b/src/lex.l	Mon Jan 09 18:58:33 1995 +0000
@@ -450,7 +450,7 @@
 %} 
 
 {CCHAR} {
-    if (nesting_level.empty () && beginning_of_function)
+    if (! help_buf && beginning_of_function && nesting_level.empty ())
       {
 	grab_help_text ();
 	beginning_of_function = 0;
@@ -1093,59 +1093,60 @@
   return curr_sym_tab->lookup (name, 1, 0);
 }
 
-// Grab the help text from an function file.
+// Grab the help text from an function file.  Always overwrites the
+// current contents of help_buf.
 
 static void
 grab_help_text (void)
 {
-  if (! help_buf)
-    {
-      ostrstream buf;
+  delete [] help_buf;
+  help_buf = 0;
+
+  ostrstream buf;
+
+  int in_comment = 1;
+  int c = 0;
 
-      int in_comment = 1;
-      int c = 0;
-
-      while ((c = yyinput ()) != EOF)
+  while ((c = yyinput ()) != EOF)
+    {
+      if (in_comment)
 	{
-	  if (in_comment)
+	  buf << (char) c;
+	  if (c == '\n')
+	    in_comment = 0;
+	}
+      else
+	{
+	  switch (c)
 	    {
-	      buf << (char) c;
-	      if (c == '\n')
-		in_comment = 0;
-	    }
-	  else
-	    {
-	      switch (c)
-		{
-		case '%':
-		case '#':
-		  in_comment = 1;
-		  break;
+	    case '%':
+	    case '#':
+	      in_comment = 1;
+	      break;
 
-		case ' ':
-		case '\t':
-		  break;
+	    case ' ':
+	    case '\t':
+	      break;
 
-		default:
-		  goto done;
-		}
+	    default:
+	      goto done;
 	    }
 	}
-
-    done:
+    }
 
-      if (c)
-	yyunput (c, yytext);
+ done:
 
-      buf << ends;
+  if (c)
+    yyunput (c, yytext);
 
-      help_buf = buf.str ();
+  buf << ends;
+
+  help_buf = buf.str ();
 
-      if (! help_buf || ! *help_buf)
-	{
-	  delete [] help_buf;
-	  help_buf = 0;
-	}
+  if (! help_buf || ! *help_buf)
+    {
+      delete [] help_buf;
+      help_buf = 0;
     }
 }