diff libinterp/interpfcn/input.cc @ 16207:0467d68ca891

move current_input_line to lexical_feedback class * input.h, input.cc, lex.h, lex.ll (current_input_line): Declare as member of lexical_feedback class. (octave_base_reader::octave_gets, octave_terminal_reader::get_input, octave_file_reader::get_input, octave_eval_string_reader::get_input): Don't set current_input_line. (octave_lexer::read): Set current_input_line. * oct-parse.in.yy (octave_parser::bison_error): Use curr_lexer->current_input_line.
author John W. Eaton <jwe@octave.org>
date Wed, 06 Mar 2013 19:39:48 -0500
parents 127cccb037bf
children ed91ab4d4515
line wrap: on
line diff
--- a/libinterp/interpfcn/input.cc
+++ b/libinterp/interpfcn/input.cc
@@ -106,9 +106,6 @@
 // Should we issue a prompt?
 int promptflag = 1;
 
-// The current line of input, from wherever.
-std::string current_input_line;
-
 // TRUE after a call to completion_matches.
 bool octave_completion_matches_called = false;
 
@@ -242,19 +239,17 @@
       history_skip_auto_repeated_debugging_command = true;
     }
 
-  current_input_line = retval;
-
-  if (! current_input_line.empty ())
+  if (! retval.empty ())
     {
       if (! history_skip_auto_repeated_debugging_command)
-        command_history::add (current_input_line);
+        command_history::add (retval);
 
-      octave_diary << current_input_line;
+      octave_diary << retval;
 
-      if (current_input_line[current_input_line.length () - 1] != '\n')
+      if (retval[retval.length () - 1] != '\n')
         octave_diary << "\n";
 
-      do_input_echo (current_input_line);
+      do_input_echo (retval);
     }
   else
     octave_diary << "\n";
@@ -560,11 +555,7 @@
 
   eof = false;
 
-  std::string retval = octave_gets (eof);
-
-  current_input_line = retval;
-
-  return retval;
+  return octave_gets (eof);
 }
 
 const std::string octave_file_reader::in_src ("file");
@@ -576,11 +567,7 @@
 
   eof = false;
 
-  std::string retval = octave_fgets (file, eof);
-
-  current_input_line = retval;
-
-  return retval;
+  return octave_fgets (file, eof);
 }
 
 const std::string octave_eval_string_reader::in_src ("eval_string");
@@ -603,8 +590,6 @@
   if (retval.empty ())
     eof = true;
 
-  current_input_line = retval;
-
   return retval;
 }