diff src/pt-cmd.h @ 8844:c84a5b6377c4

better handling of end of script/function no-op command
author John W. Eaton <jwe@octave.org>
date Mon, 23 Feb 2009 12:55:32 -0500
parents 73c4516fae10
children 35cd375d4bb3
line wrap: on
line diff
--- a/src/pt-cmd.h	Mon Feb 23 12:44:57 2009 -0500
+++ b/src/pt-cmd.h	Mon Feb 23 12:55:32 2009 -0500
@@ -65,7 +65,8 @@
 public:
 
   tree_no_op_command (const std::string& cmd = "no_op", int l = -1, int c = -1)
-    : tree_command (l, c), orig_cmd (cmd) { }
+    : tree_command (l, c), eof (cmd == "endfunction" || cmd == "endscript"),
+      orig_cmd (cmd) { }
 
   ~tree_no_op_command (void) { }
 
@@ -74,10 +75,14 @@
 
   void accept (tree_walker& tw);
 
+  bool is_end_of_fcn_or_script (void) const { return eof; }
+
   std::string original_command (void) { return orig_cmd; }
 
 private:
 
+  bool eof;
+
   std::string orig_cmd;
 
   // No copying!