changeset 10130:0c3609dd34cf

oct-parse.yy (eval_string): save and set reading_{script,fcn,classdef}_file vars
author John W. Eaton <jwe@octave.org>
date Mon, 18 Jan 2010 16:04:09 -0500
parents ab80681c44d9
children 30817aa3889a
files scripts/ChangeLog scripts/testfun/test.m src/ChangeLog src/oct-parse.yy
diffstat 4 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,6 +1,10 @@
+2010-01-18  John W. Eaton  <jwe@octave.org>
+
+	* testfun/test.m: Undo previous change.
+
 2010-01-18  David Grundberg  <davidg@cs.umu.se>
 
-	* testfun/test.m: Fix !function test blocks.
+	* testfun/test.m: Append endfunction to function test blocks.
 
 2010-01-17  Thorsten Meyer  <thorsten.meyier@gmx.de>
 
--- a/scripts/testfun/test.m
+++ b/scripts/testfun/test.m
@@ -348,7 +348,7 @@
 			 __signal_fail);
       else
         __name = __block(__name_position(1):__name_position(2));
-        __code = [__block "\nendfunction"];
+        __code = __block;
         try
           eval(__code); ## Define the function
           __clear = sprintf ("%sclear %s;\n", __clear, __name);
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2010-01-18  John W. Eaton  <jwe@octave.org>
+
+	* oct-parse.yy (fcn_end): Allow EOF as end of function if
+	reading from eval string.
+	(eval_string): Protect and set reading_fcn_file,
+	reading_script_file, and reading_classdef_file.
+
 2010-01-18  Jaroslav Hajek  <highegg@gmail.com>
 
 	* xpow.cc (xpow (const NDArray&, double), xpow (const FloatNDArray&,
--- a/src/oct-parse.yy
+++ b/src/oct-parse.yy
@@ -1399,7 +1399,8 @@
 			YYABORT;
 		      }
 
-		    if (! reading_fcn_file && ! reading_script_file)
+		    if (! (reading_fcn_file || reading_script_file
+                           || get_input_from_eval_string))
 		      {
 			yyerror ("function body open at end of input");
 			YYABORT;
@@ -4167,6 +4168,9 @@
   frame.protect_var (max_function_depth);
   frame.protect_var (parsing_subfunctions);
   frame.protect_var (endfunction_found);
+  frame.protect_var (reading_fcn_file);
+  frame.protect_var (reading_script_file);
+  frame.protect_var (reading_classdef_file);
 
   input_line_number = 1;
   current_input_column = 1;
@@ -4178,6 +4182,9 @@
   max_function_depth = 0;
   parsing_subfunctions = false;
   endfunction_found = false;
+  reading_fcn_file = false;
+  reading_script_file = false;
+  reading_classdef_file = false;
 
   current_eval_string = s;