diff libinterp/parse-tree/lex.ll @ 16212:d2b268936783 classdef

maint: periodic merge of default to classdef
author John W. Eaton <jwe@octave.org>
date Thu, 07 Mar 2013 10:25:39 -0500
parents 3449bf257514 e7ff32e7cf82
children d8c0f46efaf0
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll
+++ b/libinterp/parse-tree/lex.ll
@@ -538,7 +538,7 @@
     else
       curr_lexer->looking_at_matrix_or_assign_lhs = true;
 
-    promptflag--;
+    curr_lexer->decrement_promptflag ();
     curr_lexer->eat_whitespace ();
 
     curr_lexer->bracketflag++;
@@ -602,7 +602,7 @@
     if (yytext[0] == '\\')
       curr_lexer->gripe_matlab_incompatible_continuation ();
     curr_lexer->scan_for_comments (yytext);
-    promptflag--;
+    curr_lexer->decrement_promptflag ();
     curr_lexer->input_line_number++;
     curr_lexer->current_input_column = 1;
   }
@@ -781,7 +781,7 @@
     curr_lexer->input_line_number++;
     curr_lexer->current_input_column = 1;
     curr_lexer->block_comment_nesting_level++;
-    promptflag--;
+    curr_lexer->decrement_promptflag ();
 
     bool eof = false;
     curr_lexer->process_comment (true, eof);
@@ -852,7 +852,7 @@
     curr_lexer->at_beginning_of_statement = false;
 
     curr_lexer->nesting_level.paren ();
-    promptflag--;
+    curr_lexer->decrement_promptflag ();
 
     TOK_RETURN ('(');
   }
@@ -920,7 +920,7 @@
     curr_lexer->looking_for_object_index = false;
     curr_lexer->at_beginning_of_statement = false;
 
-    promptflag--;
+    curr_lexer->decrement_promptflag ();
     curr_lexer->eat_whitespace ();
 
     curr_lexer->braceflag++;
@@ -1339,6 +1339,7 @@
   looking_at_function_handle = 0;
   block_comment_nesting_level = 0;
   token_count = 0;
+  current_input_line = "";
   help_text = "";
   fcn_file_name = "";
   fcn_file_full_name = "";
@@ -1447,7 +1448,7 @@
   parser_symtab_context.clear ();
 
   // We do want a prompt by default.
-  promptflag = 1;
+  promptflag (1);
 
   // Only ask for input from stdin if we are expecting interactive
   // input.
@@ -1460,6 +1461,8 @@
             || input_from_eval_string ()))
     yyrestart (stdin, scanner);
 
+  input_reader.reset ();
+
   lexical_feedback::reset ();
 }
 
@@ -1479,8 +1482,8 @@
   if (input_buf.empty ())
     {
       bool eof = false;
-      std::string input = input_reader.get_input (eof);
-      input_buf.fill (input, eof);
+      current_input_line = input_reader.get_input (eof);
+      input_buf.fill (current_input_line, eof);
     }
 
   if (! input_buf.empty ())
@@ -1785,25 +1788,25 @@
         case for_kw:
         case parfor_kw:
         case while_kw:
-          promptflag--;
+          decrement_promptflag ();
           looping++;
           break;
 
         case do_kw:
           at_beginning_of_statement = true;
-          promptflag--;
+          decrement_promptflag ();
           looping++;
           break;
 
         case try_kw:
         case unwind_protect_kw:
           at_beginning_of_statement = true;
-          promptflag--;
+          decrement_promptflag ();
           break;
 
         case if_kw:
         case switch_kw:
-          promptflag--;
+          decrement_promptflag ();
           break;
 
         case get_kw:
@@ -1826,7 +1829,7 @@
 
         case classdef_kw:
           // 'classdef' is always a keyword.
-          promptflag--;
+          decrement_promptflag ();
 
           if (! force_script && token_count == 0 && input_from_file ())
             {
@@ -1836,7 +1839,7 @@
           break;
 
         case function_kw:
-          promptflag--;
+          decrement_promptflag ();
 
           defining_func++;
           parsed_function_name.push (false);
@@ -1939,12 +1942,12 @@
                         if (type == '{')
                           {
                             block_comment_nesting_level++;
-                            promptflag--;
+                            decrement_promptflag ();
                           }
                         else
                           {
                             block_comment_nesting_level--;
-                            promptflag++;
+                            increment_promptflag ();
 
                             if (block_comment_nesting_level == 0)
                               {
@@ -2047,7 +2050,7 @@
                         done = true;
 
                         block_comment_nesting_level++;
-                        promptflag--;
+                        decrement_promptflag ();
 
                         buf += grab_block_comment (reader, eof);
 
@@ -2647,7 +2650,7 @@
               octave_comment_buffer::append (comment_buf);
             }
           current_input_column = 0;
-          promptflag--;
+          decrement_promptflag ();
           gripe_matlab_incompatible_continuation ();
           return true;