changeset 8537:17ef48c699a5

lex.l (grab_comment_block): if not reading from a file, bail at first newline inside a comment:
author John W. Eaton <jwe@octave.org>
date Mon, 19 Jan 2009 20:21:45 -0500
parents de1b944d5306
children f4a4f914462e
files src/ChangeLog src/lex.l
diffstat 2 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
 2009-01-19  John W. Eaton  <jwe@octave.org>
 
+	* lex.l (grab_comment_block): If not reading input from a file,
+	bail out at first newline inside a comment.
+
 	* lex.l (lexer_debug_flag): New static variable.
 	(F__lexer_debug_flag__): New function.
 	(LEXER_DEBUG): New macro.  Use it in all patterns.
--- a/src/lex.l
+++ b/src/lex.l
@@ -1667,6 +1667,20 @@
 	      at_bol = true;
 	      current_input_column = 0;
 	      in_comment = false;
+
+	      // FIXME -- bailing out here prevents things like
+	      //
+	      //    octave> # comment
+	      //    octave> x = 1
+	      //
+	      // from failing at the command line, while still
+	      // allowing blocks of comments to be grabbed properly
+	      // for function doc strings.  But only the first line of
+	      // a mult-line doc string will be picked up for
+	      // functions defined on the command line.  We need a
+	      // better way of collecting these comments...
+	      if (! (reading_fcn_file || reading_script_file))
+		goto done;
 	    }
 	}
       else